On Jan 7, 2008 6:59 PM, Robert Citek <[EMAIL PROTECTED]> wrote:
> How can I get rid of the @foo?
>
> This does what I want, but uses the "temporary" variable @foo:
>
> $ ls | perl -e '@foo=<>; chomp @foo ; print join(" ", @foo)'
>
> This eliminates the temporary variable but doesn't work:
>
> $ ls | perl -e 'print join(" ", chomp(<>))'
>
> Thanks in advance.
>
> Regards,
> - Robert

It looks like you are trying to turn this

foo
bar
baz

into this

foo bar baz

A much better way is this

perl -pe 's/\n/ /';

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


Reply via email to