in reply to Re: duplicate $_ while reading files; my compactness; code structure
in thread duplicate $_ while reading files; my compactness; code structure

my @all = <FILE>; my @some = grep { !/^\s*$/ } (my @most = map { s/#.*$//; $_ } @all);
Beware... that last map alters @all. It's very misleading.

If you're going to "copy and change", a nice idiom (which I've talked about here in the past) is:

s/#.*$// for my @most = @all;
Although this isn't actually correct in the context of the original question. Just posting a better way to do what you ended up accidentally doing.

-- Randal L. Schwartz, Perl hacker