Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Please fix my writing style

by blazar (Canon)
on Nov 23, 2008 at 23:24 UTC ( [id://725489]=note: print w/replies, xml ) Need Help??


in reply to Re: Please fix my writing style
in thread Please fix my writing style

Although now with 5.10 you could do
while ( <DATA> ) { given( $_ ) { when ( $_ =~ /^NEW YORK:..../ ) { expression; } ... default { ... } } }
Which is pretty nifty, imo

I personally believe that the most powerful characteristic of C<when>'s is the syntactic sugar it provides with implicit matches: which most of the times, actually happen to be smart matches - albeit not in this particular case, in which a similar beast that is a regular bind would be used anyway; thus you wouldn't do $_ =~ /REGEX/ but just as you wouldn't do in Perl quite about anywhere: because as usual you either want to use a full fledged generic variable and the binding operator, or the "topicalizer," i.e. $_, i.e. the pronoun "it" - but implicitly!

--
If you can't understand the incipit, then please check the IPB Campaign.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-19 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found