in reply to Format string and regex question
That keeps the users out of your name space entirely, and drops the reliance on the 'eval'. This should be tons more efficient for you.sub foo { my $format_string = shift; my %vars = ( a => ..., b => ..., c => ..., ); $format_string =~ s/(%(\w))/$vars{$1}/eg; return $format_string; }
|
|---|