</S>Update: withdrawn. Use split().
Attempting to zero in on the problem you're having, it seems you are having trouble printing the match variables, $1, $2, .., $15. Perhaps another way of determining what matched might be in order (I've taken the liberty of changing your regex slightly using /x, for readibility):
my @match_flds = /(\d{4}) \s (\d{5}) \s (\d{3}) \s (\d{2}) \s (\d{2} \/ \d{2} \/ \d{2}) \s (\d{2} \: \d{2} \: \d{2}) \s (\d{3}) \s (\d{2}) \s (\S+) \s (\d{2}) \s (\d{2}) \s (\d{2}) \s (\d{2}) \s (\w{3}) $ /x ; if (@match_flds) { # now indexes are 1-off from the corresponding numbered # regex vars: e.g., $match_flds[0] is $1, $match_flds[1] is $2, etc. # remap the 15th field using your hash $match_flds[14] = $TOC{ $match_flds[14] }; # print them print join( ' ', @match_flds ), "\n"; }
dmm
You can give a man a fish and feed him for a day ...In reply to Re: Is it Possible to match contents in hash via a Regex?
by dmmiller2k
in thread Is it Possible to match contents in hash via a Regex?
by brassmon_k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |