in reply to Interpolation inside regex
Yes. See the /e modifier in perlre:
foreach $name ( @names ){ $name = ucfirst($name); # made first letter $name =~ s/\_(\w)/\ uc($1)/ge; # Here is the point. print "$name \n"; }
You can also change that to:
foreach $name ( @names ){ $name = ucfirst($name); # made first letter $name =~ s/_(\w)/ \U$1/g; print "$name \n"; }
to avoid the /e. Also, see perlre again for \U and \L.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Interpolation inside regex
by vc_will_do (Sexton) on Sep 07, 2007 at 08:49 UTC |