On Thursday 13 December 2007 03:52, Jenda Krynicky wrote:
>
> From: John W.Krahn <[EMAIL PROTECTED]>
>
> > On Wednesday 12 December 2007 07:15, Jenda Krynicky wrote:
> > > From: jeff pang <[EMAIL PROTECTED]>
> > > >
> > > > You can add a "\n" (or "\r\n" on windows,etc) at the end of
> > > > each element in the array,like,
> > > >
> > > > push @new,$_."\n" for @old;
> > >
> > > Why not
> > >
> > >  my @new = map $_."\n", @old;
> > >
> > > ? Or
> > >
> > >  my @new = map {$_."\n"} @old;
> >
> > Or:
> >
> > $_ .= "\n" for my @new = @old;
>
> I have to admit that this would left me wondering whether the @new is
> lexical only to the loop or to the enclosing block.

Read the "Simple statements" section of perlsyn.  The 'for' statement 
modifier is an iterator, not a loop.  And there are no {} braces so 
there is no block.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to