I dread +shift (and anything with a + to force scalar context, it just looks so kludgy...), I guess you could use $_0 instead ?

Yes. Or add my ($var) = @_ then use $var.

Why are you using quotemeta ?

In case there are any special characters in the words being joined. If there was a "*" in the word, for example, it would need to be escaped because we're forming a regexp. That's exactly what quotemeta does.


In reply to Re^3: Perl can do it, take 1 (sentence generation) by ikegami
in thread Perl can do it, take 1 (sentence generation) by spurperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":