Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^6: Noob could use advice on simplification & optimization

by Anonymous Monk
on May 08, 2012 at 13:03 UTC ( #969448=note: print w/replies, xml ) Need Help??


in reply to Re^5: Noob could use advice on simplification & optimization
in thread Noob could use advice on simplification & optimization

'my' variables are lexical to the enclosing block. Here, since the variables are declared in the MAIN package, outside of any block, they are global, or visible to all all blocks within the package MAIN.

Almost. They have file scope, they're global to the file. See Lexical scoping like a fox,

$ cat foo1.pl my $foo = qq{i'm in main too ${\__FILE__}\n}; sub foo1 { print $foo; } $ cat foo2.pl my $foo = qq{i'm in main too ${\__FILE__}\n}; sub foo2 { print $foo; } $ perl -e " require $_ for qw/ foo1.pl foo2.pl /; foo1(); foo2(); " i'm in main too foo1.pl i'm in main too foo2.pl

Replies are listed 'Best First'.
Re^7: Noob could use advice on simplification & optimization
by bgreg (Initiate) on May 09, 2012 at 20:20 UTC
    Got it. Thanks all!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://969448]
help
Chatterbox?
[Corion]: Krug is generic pottery ware for pouring beverages, but a Bembel is painted with that blue paint and contains only (!) Apfelwein
[shmem]: Corion: alas, air too.
[Corion]: shmem: Yes, very sad!
[choroba]: doesn't sound much useful, which means I'll probably remember it
[karlgoethebier]: "that blue pain" == Salzglasur as far as i remember
[karlgoethebier]: Paint!
[shmem]: karlgoethebier the blue pain comes after all bembels are empty
[karlgoethebier]: Confusing "Bembel" with "Membel" might result in a slap in the face in Hesse...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-05-24 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?