And what exactly is so useful? Why a sub, when it does just a little? Wouldn't
$string =~ /$regex/ be a LOT clearer and easier?
By the way, parens can be used for either grouping
(foo|bar) and capturing. How did you explain the difference between the two without using both?
If demonstrating regexes, it might be good to use
$&.
2;0 juerd@ouranos:~$ perl -e'undef christmas'
Segmentation fault
2;139 juerd@ouranos:~$