Huh? grep() in scalar context returns a number, not a join()ed list of elements that passed through. And print() doesn't "force scalar context" -- in fact, it invokes list context, which is the only reason why print invert($string) works.
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perlhacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;