in reply to Array indexing and string manipulation
This probably has all the efficiency of Schlemiel the Painter, but it has some humor value:
!$array[$_] && $string =~ s/(?<=^.{$_})(.)/lc $1/e for 0 .. $#array;
Silly at best, but it works. :)
This isn't as fun, but doesn't suffer from a lookbehind assertion that grows as the index increases:
!$array[$_] and substr( $string, $_, 1 ) = lc substr( $string, $_, 1 ) for 0 .. $#array;
Dave
|
|---|