Re: perl -s and use strict
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 29 Mar 2007 04:35:52 -0700
On Mar 29, 3:26 am, chas.ow...@xxxxxxxxx (Chas Owens) wrote:
On 3/29/07, Sarthak Patnaik <sarthak.patn...@xxxxxxxxxxx> wrote:
snip> Is there any workaround for this, so that I can use strict and -s together.
snip
Short answer: yes, the vars pragma
The vars pragma has been depreciated for about a decade. Please use
the our keyword.
perldoc -f our
#!/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:
Please, enlighten us as to what -s does that believe the OP did not
believe it does.
-s is perfectly fine for rudimentary command-line switching, for short
simple programs that don't need the bulk of the Getopt::* modules.
Paul Lalli
.
- References:
- perl -s and use strict
- From: Sarthak Patnaik
- Re: perl -s and use strict
- From: Chas Owens
- perl -s and use strict
- Prev by Date: Re: perl -s and use strict
- Next by Date: XML parsing REST responses
- Previous by thread: Re: perl -s and use strict
- Next by thread: Re: perl -s and use strict
- Index(es):
Relevant Pages
|