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.