in reply to Character positioning
This uses the @- array which holds the offsets of the entire match and the $1 (etc.) variables. Basically, $-[0] gives me the offset in the string we matched against where the pattern started. Since the real word and the revealed word are "identical", the offsets are the same.while ($current{word} =~ /$letter/g) { substr $current{revealed}, $-[0], 1, $letter; }
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
|---|