in reply to Character positioning
All these approches are fine, but one seems to forget that a word can contain the character multiple times. I would follow an entire new direction.
printsmy $word="cacao"; my @word=split ('',$word); my @string=('_') x scalar @word; my $char="c"; map { $string[$_] = $char if $word[$_] eq $char } 0..$#word; print @string;
|
|---|