my $index; while ( $index < length( $string) ) { substr( $string, $index, 1) = fiddle(substr( $string, $index, 1)); $index++; }