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 d
Sorry I missed out.
# ./test.pl -k=hello
Variable "$k" is not imported at ./test.pl line 4.
Global symbol "$k" requires explicit package name at ./test.pl line 4.
Execution of ./test.pl aborted due to compilation errors.
#
Regards,
Sarthak
-Original Message-
From: Sarthak Patnaik [mailt
>
>
>
>#!/usr/bin/perl -ws
>
>use strict;
>
>print $k;
>
>
>
>As I am using "use strict;", it is giving the following message:
>
>Variable "$k" is not imported at ./test.pl line 3.
>
This is because you didn't declare that variable $k before using it.
You may do:
my $k; # declare $k as a lexic