But my script was malfunctioning for a bunch of people, and I finally figured out why. Fucking Unicode again. If $LANG contains "utf8" (which is the default on recent Red Hat systems), then "^\w" doesn't work right, among other things. Check this out:
echo -n "foo.bar" | \
perl -e '$_ = <>; print join (" | ", split (/([^\w]+)/)) . "\n";'
===> "foo | . | bar" (right)
setenv LANG en_US.utf8
echo -n "foo.bar" | \
perl -e '$_ = <>; print join (" | ", split (/([^\w]+)/)) . "\n";'
===> "foo.bar" (wrong!)
It works fine in both cases if you do
perl-5.8.0-88, Red Hat 9. Hate.