Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Re: namespace craziness

by chipmunk (Parson)
on Jan 30, 2001 at 22:15 UTC ( #55300=note: print w/replies, xml ) Need Help??


in reply to Re: Re: namespace craziness
in thread namespace craziness

$x was declared with my, so it is a lexical variable and not in any namespace/package. The package declarations are really a red herring in this code. Compare these similar scripts:
#!/usr/bin/perl -w use strict; use constant FIRST => 25; my $x = FIRST; use constant SECOND => defined $x ? FIRST : 2; print SECOND * $x, "\n"; __END__
#!/usr/bin/perl -w use strict; use constant FIRST => 25; my $x ; BEGIN { $x = FIRST; } use constant SECOND => defined $x ? FIRST : 2; print SECOND * $x, "\n"; __END__

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://55300]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2023-09-22 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?