On Jan 8, 2008 9:40 AM, Robert Citek <[EMAIL PROTECTED]> wrote:
> On Jan 8, 2008 9:24 AM, Robert Citek <[EMAIL PROTECTED]> wrote:
> > What I really want to know is if there's a way to eliminate the
> > temporary variable.  If not, that's fine.  I was just wondering if
> > there's something I'm overlooking.  Come to think of it, maybe I could
> > use map.
>
> Here's an example closer to the real problem:
>
> $ ls | perl -e '@F=(<>) ; chomp @F ; print "('\''" .
> join("'\'',\n'\''",@F) . "'\'') \n" ; '

Yup.  map works:

$ ls | perl -e 'print "('\''" . join("'\'','\''", map { chomp; $_ }
(<>) ) . "'\'') \n" ; '

Thanks for letting me bounce ideas in the open.

Regards,
- Robert

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


Reply via email to