Closed
Description
perlop and perlre explain everything in extreme detail, but never seem
to give an example of how to write the modifier of
/bla/i
dynamically.
Nope,
my $modifier='i';
/bla/$modifier
won't work.
Sure, one could use 'eval', but that would end up eval'ing the /bla/
part too.
So please add an example to those documentation pages.
Or mention the only way is to do
if($modifier eq 'i'){
... /bla/i ...
elsif($modifier eq 'ia'){
/bla/ia ...
etc. Thanks.
Hmmm, reminds me of sprintf:
You can also get the precision from the next argument using
".*", or from a specified argument (e.g., with ".*2$"):