From: John W.Krahn <[EMAIL PROTECTED]>
> On Wednesday 12 December 2007 07:15, Jenda Krynicky wrote:
> > From: jeff pang <[EMAIL PROTECTED]>
> >
> > > --- "Sayed, Irfan (Irfan)" <[EMAIL PROTECTED]> wrote:
> > > > My query is that can i store the output of this for loop in
> > > > variable or
> > > > list. so that if i print the content of that variable or array
> > > > then it
> > > > should print as
> > > >
> > > > dadsad
> > > > assasd
> > >
> > > 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.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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


Reply via email to