[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Modifiers



What I find ultra cool in Perl are modifiers, and I try to use them often. But I can't find for this expression the appropriate syntax and I was wondering if its possible to pack this in one line (and stay legible). 

@list =  (1..9);

foreach(@list) {print "$_\n"} if (@list);  # Syntax error...

or

(@list) ? foreach(@list) {print "$_\n"} : print "Empty list\n"; #Syntax error...

Cheers

-Emmanuel
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Emmanuel M. Dˇcarie - <emm@cam.org>
---> The Frontier Newbie Toolbox:
<http://www.cam.org/~emm/frontierNewbieToolbox.html>
---> Frontier en fran¨ais ! 
<http://www.scripting.com/frontier5/francais/>
<http://www.scriptmeridian.org/tutorials/francais/odb/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch