On 3/29/07, Sarthak Patnaik <[EMAIL PROTECTED]> wrote:
snip
Is there any workaround for this, so that I can use strict and -s together.
snip
Short answer: yes, the vars pragma
#!/usr/bin/perl -ws
use strict;
use vars qw($k);
print "$k\n"
Long answer: It is however a bad idea. -s does not do what you think
it does. It looks like what you want is the Getopt::Std module:
#!/usr/bin/perl
use warnings;
use strict;
use Getopt::Std;
my %opts;
getopt('k:', \%opts);
my $k = exists $opts{k} ? $opts{k} : "Default";
print "$k\n";
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/