Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Please fix my writing style

by blazar (Canon)
on Nov 23, 2008 at 23:24 UTC ( #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.


Comment on Re^2: Please fix my writing style
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-12-21 20:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (107 votes), past polls