Rodrick Brown wrote:
@list = map { $c = $_; $c =~ s/\s+/_/g; $c } @d = grep { /\d/ } <FH>;

Is there a way to shorten the following mostly concerned with why I
have to use a temporary variable.

The temporary variable is there because modifying $_ would alter the
contents of the @d array which is presumably required intact.

Putting all of this into a single statement doesn't make for readable
programming. It is much better as:

my @d = <FH>;
my @list = @d;
s/\s+/_/g foreach @list;

Rob

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


Reply via email to