The following module was proposed for inclusion in the Module List: modid: Data::SearchReplace DSLIP: bdphp description: regex search/replace in complex data structs userid: YXES (Stephen D. Wells) chapterid: 6 (Data_Type_Utilities) communities:
similar: rationale: Data::SearchReplace - Working on complex data structures, this pure Perl module peforms search and replace functions for each value within the structure. It is accessible using a simple attribute call such as: use Data::SearchReplace qw(sr); sr({SEARCH=>'foo', REPLACE=>'bar'}, \$complex_var); or OO... $sr = Data::SearchReplace->new( {SEARCH=>'foo',REPLACE=>'bar'}); $sr->sr(\$complex_var); You can (of course) pass a full regex as well. sr({REGEX => 's/(\w+).*/$1/g'}, \$complex_var); With the use of templates (ie Template-Toolkit and HTML::Template) on the rise and the fact that they utilize complex data structures the usefulness of such a function goes up dramatically. Many times there are situations where you might to need to escape a character or alter that data just before it is sent to a template module and this function makes it easy to do that in one line. enteredby: YXES (Stephen D. Wells) enteredon: Sat May 31 16:03:35 2003 GMT The resulting entry would be: Data:: ::SearchReplace bdphp regex search/replace in complex data structs YXES Thanks for registering, -- The PAUSE PS: The following links are only valid for module list maintainers: Registration form with editing capabilities: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=49400000_e438e9fe03198f68&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=49400000_e438e9fe03198f68&SUBMIT_pause99_add_mod_insertit=1