Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Lexical vs. Package Variables (With a little local thrown in)

by ant9000 (Monk)
on Jun 20, 2003 at 08:28 UTC ( #267482=note: print w/ replies, xml ) Need Help??


in reply to Lexical vs. Package Variables (With a little local thrown in)

I find your explanations nice and clear; maybe you could also append the output of your scripts, just to make your points even easier to grasp.
A note about local: it's real use is for temporarily overwriting Perl's automatic variables, which cannot be redeclared as lexicals, for instance

#here $/ is usually a newline (on Unix, at least) { #localize the input record separator and undefine it local $/=undef; #now reading from STDIN yelds the entire contents at once my $whole_file=<>; #do what you like with lexical $whole_file #... } #here $/ is restored back to its original value


Comment on Re: Lexical vs. Package Variables (With a little local thrown in)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2014-09-19 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (144 votes), past polls