in reply to duplicate $_ while reading files; my compactness; code structure
Although this does make assumptions like comments not being in the middle of quotes and the like, otherwise you'll want some slightly fancier parsing than the above. Also, did you *just* want to get rid of the hashes (like you say), or the hashes *and* the comments (like you code)?my @some = grep { !/^\s*$/ } (my @most = map { s/#.*$//; $_ } <FILE>);
broquaint
Update: yes running the code first might be an idea... now works proper.
Update 2: sometimes they come back... got rid of @all as I didn't *really* need it, as merlyn indirectly illustrates below :o)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: duplicate $_ while reading files; my compactness; code structure
by merlyn (Sage) on Oct 03, 2001 at 21:33 UTC |