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

Re^5: list item comparison

by johngg (Canon)
on Jul 13, 2012 at 08:52 UTC ( [id://981583]=note: print w/replies, xml ) Need Help??


in reply to Re^4: list item comparison
in thread list item comparison

The only catch is that you can execute only one statement per iteration/condition with this syntax.

That's where do blocks come in handy :-)

knoppix@Microknoppix:~$ perl -E ' > $sayIt = 1; > do { > say q{Hello}; > say q{World}; > } if $sayIt;' Hello World knoppix@Microknoppix:~$

I hope this is of interest.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^6: list item comparison
by nitin1704 (Sexton) on Jul 13, 2012 at 09:16 UTC
    There's always something to learn! Thanks John. I'm a beginner too by the way, started learning Perl a couple of months ago.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2024-04-23 14:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found