On 7/15/07, Rodrick Brown <[EMAIL PROTECTED]> 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.

Unless you have some reason to store the intermediate results you can say:

@list = map { s/\s+/_/g; $_ } grep { /\d/ } <FH>;

But this is probably a bad idea; generally speaking, file handles
should not be put in list context.

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


Reply via email to