Mr. Shawn H. Corey wrote: > On Tue, 2006-09-05 at 01:33 +0200, Paul Johnson wrote: >>Um, that's not quite correct. >> >>See `perldoc -f split` for details. > > Oh, yes, a special case. I have long ago abandoned special cases since > they lead to errors. Note that `perldoc -f split` starts with: > > split /PATTERN/,EXPR,LIMIT > split /PATTERN/,EXPR > split /PATTERN/ > split > > Note: no strings. Strings do not work well when used as the pattern for > split.
Anything used as a pattern is a string. See the "Quote and Quote-like Operators" section of perlop: perldoc perlop $ perl -le' my $string = q[ a b c d ]; print join "\t", map "<$_>", split q[\s+], qq[$string], q[4]; print join "\t", map "<$_>", split /\s+/, $string, 4; ' <> <a> <b> <c d > <> <a> <b> <c d > $ perl -le' my $w = 3; my $x = 7; my $y = 2; my $z = 6; print join "\t", map "<$_>", split $w * $x - $y * $z, q[one] . ( $w + $z ) . q[two] . ( $x + $y ) . q[three]; ' <one> <two> <three> John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>