Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: namespace craziness

by chipmunk (Parson)
on Jan 30, 2001 at 22:15 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2025-03-17 05:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (54 votes). Check out past polls.