M. Lewis wrote: > > John W. Krahn wrote: >> M. Lewis wrote: >>> >>> my ($prod, $flavor) = split /\s/, $ln, 2; >> >> You probably should use ' ' instead of /\s/ as the first argument to >> split: >> >> my ($prod, $flavor) = split ' ', $ln, 2; > > Ok, but why? Are they not the same?
No. $ perl -le' my $ln = " one two three four "; print map " *$_* ", split /\s/, $ln, 2; print map " *$_* ", split " ", $ln, 2; ' ** * one two three four * *one* *two three four * $ perl -le' my $ln = "one two three four "; print map " *$_* ", split /\s/, $ln, 2; print map " *$_* ", split " ", $ln, 2; ' *one* * two three four * *one* *two three four * /\s/ matches a single whitespace character, ' ' matches one or more whitespace characters. John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>