develooper Front page | perl.perl5.porters | Postings from October 2011

Re: [perl #102464] is warning valid?

Thread Previous | Thread Next
Eric Brine
October 29, 2011 11:35
Re: [perl #102464] is warning valid?
Message ID:
On Sat, Oct 29, 2011 at 7:59 AM, Linda Walsh <>wrote:

> To be honest, I'm not even sure this is a real bug, or is be
> design, but it seems counterintuive.

if I test a variable for being 'defined' :

>        if (defined($foo)) {
>                print "foo=$foo\n";
>        }

1. The whole purpose of strict vars is to catch typos. You could have
mistyped $foo in the defined

2. strict vars checks whether something is declared or not, not whether
something is defined or not.

2a. An undeclared variable can be defined.

2b. A declared variable can be undefined.

3. strict vars occurs at compile time. Any checks you do at run time occur
far later.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About