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

Re^2: Global vs. local?

by moritz (Cardinal)
on May 28, 2009 at 09:32 UTC ( [id://766615]=note: print w/replies, xml ) Need Help??


in reply to Re: Global vs. local?
in thread Global vs. local?

Whoa! Don't.

If you tell people what not to use, also tell them what to use instead ;-)

here: perl 5.10 introduces given/when, see perl5100delta. Short example:

use 5.010; given ($value) { when (1) { ... } when (2) { ... } default { die "Don't know what to do with '$_'" } }

It's not needed here, because a closure is much better, but in general it's surely good to know.

Replies are listed 'Best First'.
Re^3: Global vs. local?
by jpavel (Sexton) on May 28, 2009 at 09:40 UTC
    Thanks, I'll make that change!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-03-29 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found