Also, take a look at this:
#!/usr/bin/perl -s
use strict;
our $h;
if ($h) {
print "this is a very special feature";
}
The -s switch "interprets -xxx on the command line as a switch and sets
the corresponding variable $xxx in the script to 1." There's also
something else, which I leave for you to discover... ;-) You know what
they say, "man perlrun"!! :-)
I usually use something like this, actually:
die "this is the help text
blah blah blah
" if $h;
HTH
Regards,
jac
On Thu, 2004-04-15 at 20:10, Jakob Kofoed wrote:
> Hello All,
>
> I'm trying to create a script with where you can put a flag to the script or
> not
> fx run it like:
>
> script -h
> or just
> script
>
> something like:
>
> if ( $ARGV[0] =~ /-h/ ) {
> print "You have chosen the very special ability!\n";
> } else {
> print "you have not chosen the very special ability!\n";
> }
>
> but when I run this one without any flag i get an error message:
> "use of initialized value in pattern match (m//)"
>
> Do I have to do it differently to get rid of the error?
>
> Thanks,
> Jakob
--
Josà Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de InformaÃÃo
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>