in reply to grep from file
You could use grep and s with a funky regex, but I think map would be simpler...
my @cxx = map { /(\w+\.cxx)@@/ ? ($1) : () } <FILE>;
Although, if all you're going to do with @cxx is print it out to a new file, you can avoid building a temporary array with something like...
print NEWFILE map { /(\w+\.cxx)@@/ ? ("$1\n") : () } <FILE>;
--k.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grep from file
by Aristotle (Chancellor) on Jul 03, 2002 at 19:12 UTC |