tedv has asked for the wisdom of the Perl Monks concerning the following question:
The input file could be several hundred lines. Now also suppose I have a hash table containing entries like:This is just lines of text here, and also there. Consider this human readable text; it's full of letters and punctuation.
There could potentially be maybe 5000 entries in this table. For each entry in the hash table, we want to find the first segment of input data that could map to the key and replace it with appropriate html. So this:my $table = { "lines_of_text" => "foo.html", "this" => "bar.html", "its_full" => "foobar.html", }
turns into this:... just lines of text ...
Of course, we link the initial This but not the this starting line 2.... just <a href="foo.html">lines of text</a> ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mass Text Replacement
by chipmunk (Parson) on Apr 25, 2001 at 06:02 UTC | |
|
(Ovid - regexes as hash keys)Re: Mass Text Replacement
by Ovid (Cardinal) on Apr 25, 2001 at 04:41 UTC | |
|
Re (tilly) 1: Mass Text Replacement
by tilly (Archbishop) on Apr 25, 2001 at 04:56 UTC | |
|
Re: Mass Text Replacement
by dws (Chancellor) on Apr 25, 2001 at 04:54 UTC | |
|
Re: Mass Text Replacement
by clintp (Curate) on Apr 25, 2001 at 04:57 UTC |