in reply to Pattern matching fails because of special characters

Where and with what is  $_ being assigned? If  $_ does not match the pattern, the while loop will never be entered. If  $_ does match, the while loop will be infinite.

c:\@Work\Perl\monks>perl -wMstrict -le "$_ = 'no joy'; ;; my $output = ''; while($_ =~ /\A([S\-\+XIO]+)\z/g) { my $part = $1; $output = $output . $part; } print qq{final output: '$output'}; " final output: ''
Please see Short, Self-Contained, Correct Example.