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

Re: [perl #102464] is warning valid?

Thread Previous | Thread Next
From:
Eric Brine
Date:
October 29, 2011 11:35
Subject:
Re: [perl #102464] is warning valid?
Message ID:
CALJW-qGZucgPTUVpjP-yqA8E9_HV=1LrK3dhXsTHCxQRc88ffQ@mail.gmail.com
On Sat, Oct 29, 2011 at 7:59 AM, Linda Walsh <perlbug-followup@perl.org>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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About