On Feb 21, Deen Hameed said:

># split works on whitespace by default
>@somearray = split $string;

Err, that splits $_ on the contents of $string.  Yes, split() uses
whitespace by default, but that default is the FIRST argument.

What I'm saying is that

  split;

is equivalent to

  split ' ';

which is equivalent to

  split ' ', $_;

You can only leave out the pattern (the first arg) if you are also leaving
out the string (the second arg).

Also, as documented, there is a difference between

  split ' '

and

  split /\s+/

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to