> -----Original Message-----
> From: Fontenot, Paul [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 10, 2002 1:02 PM
> To: Perl - Beginners (E-mail)
> Subject: Spaces...
>
>
> I have a logfile that has the following format:
>
> month day time
>
> The problem is splitting on the "space" - split(/ /).
> Sometimes there are more than one space. How can I get perl
> to split on 1 or more spaces?
In addition to the answers you've gotten, note the following
from perldoc -f split:
As a special case, specifying a PATTERN of space ("' '") will
split on white space just as "split" with no arguments does.
Thus, "split(' ')" can be used to emulate awk's default
behavior, whereas "split(/ /)" will give you as many null
initial fields as there are leading spaces. A "split" on "/\s+/"
is like a "split(' ')" except that any leading whitespace
produces a null first field. A "split" with no arguments really
does a "split(' ', $_)" internally.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]