In the first case, you're splitting on a single space ("my @trace = split("\s", ...").
Actually, it's split-ing on the letter 's' because the \ (backslash) is an escape in a double-quoted string. The escape is unrecognized but passed through, a fact that Perl would have mentioned had warnings been enabled.
c:\@Work\Perl\monks>perl -wMstrict -le "my $str = 'the rain in spain falls mainly'; ;; my @ra = split \"\s\", $str; printf qq{'$_' } for @ra; print ''; ;; @ra = split '\s', $str; printf qq{'$_' } for @ra; " Unrecognized escape \s passed through at -e line 1. 'the rain in ' 'pain fall' ' mainly' 'the' 'rain' 'in' 'spain' 'falls' 'mainly'
In reply to Re^2: output difference between backtic and open().
by AnomalousMonk
in thread output difference between backtic and open().
by AltGrendel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |