in reply to Re: duplicate $_ while reading files; my compactness; code structure
in thread duplicate $_ while reading files; my compactness; code structure
Beware... that last map alters @all. It's very misleading.my @all = <FILE>; my @some = grep { !/^\s*$/ } (my @most = map { s/#.*$//; $_ } @all);
If you're going to "copy and change", a nice idiom (which I've talked about here in the past) is:
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.s/#.*$// for my @most = @all;
-- Randal L. Schwartz, Perl hacker
|
|---|