while( $command = <> ){
$command =~ s/^\s+|\s+$//g; # trim leading and trailing spaces
if( ( @matches = $kwds =~ /\b$command\w*/g ) == 1 ){
- print "command: '$matches'\n";
+ print "command: '@matches'\n";
} elsif( @matches == 0 ){
print "no such command: '$command'\n";
} else {
have a word character up front and the same at its end, with another
palindrome in between.
- /(?: (\w) (?...Here be a palindrome...) \{-1} | \w? )/x
+ /(?: (\w) (?...Here be a palindrome...) \g{-1} | \w? )/x
Adding C<\W*> at either end to eliminate what is to be ignored, we already
have the full pattern: