RE: perl -s and use strict




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 [mailto:sarthak.patnaik@xxxxxxxxxxx]
Sent: Thursday, March 29, 2007 12:05 PM
To: beginners@xxxxxxxx
Subject: perl -s and use strict


Hello,



I have a small script:



#!/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.

Global symbol "$k" requires explicit package name at ./test.pl line 3.

Execution of ./test.pl aborted due to compilation errors.



Is there any workaround for this, so that I can use strict and -s together.



Regards,

Sarthak







Disclaimer

This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom it is addressed. If
you have received this communication in error, please immediately notify the
mailadmin@xxxxxxxxxxx and destroy the original message. The recipient should
check this email and any attachments for the presence of viruses. Ness has
taken every reasonable precaution to minimize this risk, and accepts no
liability for any damage caused by any virus transmitted in this email.
Ness reserves the rights to monitor and review the content of all messages
sent to or from this E-mail address, and store them on the Ness E-mail
system.



Disclaimer

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this communication in error, please immediately notify the mailadmin@xxxxxxxxxxx and destroy the original message. The recipient should check this email and any attachments for the presence of viruses. Ness has taken every reasonable precaution to minimize this risk, and accepts no liability for any damage caused by any virus transmitted in this email. Ness reserves the rights to monitor and review the content of all messages sent to or from this E-mail address, and store them on the Ness E-mail system.
.



Relevant Pages

  • Re: Question - anonymous recursive functions
    ... Global symbol "$F1" requires explicit package name at tp205.pl line ... Execution of tp205.pl aborted due to compilation errors. ...
    (comp.lang.perl.misc)
  • Question - anonymous recursive functions
    ... Global symbol "$F1" requires explicit package name at tp205.pl line ... Execution of tp205.pl aborted due to compilation errors. ...
    (comp.lang.perl.misc)
  • Re: Can anyone program perl and fix a script?
    ... (Missing operator before packets?) ... Global symbol "$tmp" requires explicit package name at ./natview line 14. ...
    (alt.os.linux)
  • Use Strict Question
    ... Global symbol "$OrderFile" requires explicit package name at theta.pl ... Global symbol "$referer" requires explicit package name at theta.pl ... Global symbol "@odate" requires explicit package name at theta.pl line ...
    (perl.beginners)
  • Re: First Perl/CGI need critique on current code before further developement
    ... The errors in this script are _pervasive_. ... with future reserved word at webcounter.pl line 12. ... Global symbol "$slash" requires explicit package name at webcounter.pl line ...
    (comp.lang.perl.misc)