in reply to search and replace
Next thing that's a little curious it the regex you compile for subsitution. With the other regex fixed (e.g. my ( $key, $val ) = /^(\d+)\s+(\S+)/), you'd have:
([cross-referencereferencecross]{5,15})
The character class [...] is almost certainly not what you want.
Anyway, why not simply do a hash lookup using the value of the (chomp'ed) $line, such as "cross-reference"? Something like
while (my $line = <INFILE>) { chomp($line); print $dict{$line} || $line, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: search and replace
by Anonymous Monk on Apr 03, 2009 at 13:57 UTC | |
by almut (Canon) on Apr 03, 2009 at 14:27 UTC | |
|
Re^2: search and replace
by Anonymous Monk on Apr 03, 2009 at 14:10 UTC | |
by almut (Canon) on Apr 03, 2009 at 14:21 UTC |