scodes has asked for the wisdom of the Perl Monks concerning the following question:
s/^\s+\(Text [aA].* (\d+:\d+ .*$)/\.T1 "$1/g; s/^\s+\(Text [rR].* (\d+:\d+ .*$)/\.T2 "$1/g;
Here is also a hash that is heading in the right direction ... I think ;-)
I cycle through this hash as follows, and I know there is a simpler way to do this as well, though, here is what I have got so far:%chartran = ( agrave => "s/\\\xE0/\\\[agrave]/og", aacute => "s/\\\xE1/\\\[aacute]/og", acirc => "s/\\\xE2/\\\[acirc]/og", auml => "s/\\\xE4/\\\[auml]/og", Agrave => "s/\\\xC0/\\\[Agrave]/og", Aacute => "s/\\\xC1/\\\[Aacute]/og", );
while (<VRUN>) { foreach $testchar ( keys %chartran ) { if (eval ( "$chartran{$testchar}" )) { ... write out results .... } } }
So I know I could do all this really simply. Looked at qr// and like this idea, and I think the solution is an eval or an /ee modifier, but how, exactly :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: large hash of regex substitution strings
by ikegami (Patriarch) on Oct 06, 2007 at 01:11 UTC | |
by throop (Chaplain) on Oct 06, 2007 at 04:18 UTC | |
by ikegami (Patriarch) on Oct 06, 2007 at 04:54 UTC | |
by scodes (Initiate) on Oct 07, 2007 at 04:47 UTC | |
by ikegami (Patriarch) on Oct 19, 2007 at 20:42 UTC | |
by Anonymous Monk on Oct 07, 2007 at 23:58 UTC |