----- Original Message -----
From: Peter Cornelius <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 2:49 AM
Subject: splitting strings with quoted white space


> I have this script that reads in lines from a configuration file,
processes
> them, and then stores them in a hash.  Everything is working (mostly) but
I
> really don't like the snippet below and wanted to see if anyone could
> suggest a better solution.  I would call better a syntactically shorter,
> less processor intensive, or just plain faster.  Here's the trick to the
> below sample though.  I know that I will get a line that looks like...
> NAME DELIM VALUE

Assuming that name cannot contain spaces and yout DELIM is always surouned
by spaces you could try this:

my ($name, $seperator, $value) = split (" ", $line,3);

Maarten.


Reply via email to