On Sunday 09 December 2007 17:05, Jeff Pang wrote:
>
> On Dec 10, 2007 6:23 AM, yitzle <[EMAIL PROTECTED]> wrote:
> >
> > Can the following code be done without any "code blocks"?
^^^^^^^^^^^^^^^^^^^^^^^^^
> > do {print "$_\n" if($_ > 3);} for (0..5);
> >
> > This doesn't work:
> > print "$_\n" if($_ > 3) for (0..5);
>
> $ perl -le 'print join" ",grep {$_>3} 0 ..5'
^^^^^^
Your example, without the code block, and with newlines in the correct
places:
perl -e'print map "$_\n", grep $_ > 3, 0 .. 5'
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/