in reply to Need help with Piping

a.pl is as below:
use strict; use warnings; print "$_\n" while (<>);
Update (multiple): apologies, didn't see the  $var part. I assume, you are going to use it as a list:
my @var; push(@var, $_) while(<>);

Replies are listed 'Best First'.
Re^2: Need help with Piping
by eosbuddy (Scribe) on Aug 13, 2008 at 05:53 UTC
    I forgot to mention that you will need to  chomp depending on the situation (e.g. ls adds a "\n" automatically when piped while other commands may not behave in a similar manner).