Hi,
I have to make a script with parameter that limits the character. This is the code snippet
So script.pl -teacher [string]
where teacher should only be allowed of [A-Za-z0-9_-]# , if not, print error message which is "error".
Other thing is that, the parameter -teacher have to follow the script.pl, if not, it will show an error message of "please use parameter 'teacher'. Please guide
#!/usr/bin/perl
use Getopt::Long;
my $teacher =~ s/[^A-Za-z0-9\-_].//#//g;
Getopt::Long::GetOptions("teacher=s" => \$teacher); #how can i show that a parameter that have to be inserted, if not show error "please use parameter 'teacher'
unless
{
$teacher
}
print "error";