in reply to map function - print to file problem
Somewhat unrelated to your question, but this if needs an else. You use $year later, and don't otherwise reset it:
if ($file_in_question =~ /^(\d{4})/){ $year = $1; }
As for your actual question, does this work?
print OUT for map{ s[(^\d+\s+)[\d\.]+\s+][$1]; "$year\t$_"; } sort { # ... etc.
addendum: I would follow BrowserUk's advice in Re^3: Regex problem and replace the map pipeline with a series of steps. You aren't comfortable with this code the way it is.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: map function - print to file problem
by Win (Novice) on Oct 19, 2005 at 12:25 UTC |