in reply to Handling scalars as regexs within a substitution. (Take 2)

Ok, here it goes, some points I noticed: So the code below works:
print splitter($string,"<.*?>",'(\S{18})','$1 '); sub splitter{ my($string,$spliton,$find,$replace)=@_; my @array=split(/$spliton/,$string); my $i=0; my @splitters; my $str; while($string=~/($spliton)/g){ push @splitters,$1; } my $a; for (@array){ eval "s/$find/$replace/g; "; die "$@" if $@; $str.=$array[$i]; $str.=$splitters[$i]; $i++; } $str; }
I still think that eval'ing regular expressions in a quote block may be dangerous. But as long as you control the values of the expressions, it should be ok.

Hope this helps,

--ZZamboni