Michael Hooten wrote:
>
> > my @a = map {split (/\s*=\s*/, $_, 2)} split(/\r?\n/, );
>
> Should not \s+ match \r?\n? Apparently not.
\s matches \n and \r and \f and \t and ' '. Apparently the OP only
wanted to match \r and \n. :-)
John
--
use Perl;
program
fulfillment
--
To unsubscribe,
o not
emit 'a'; whereas, 'a' should be part of the split result in the latter
case.
Thanks again.
-Original Message-
From: Robert Citek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 11:21 PM
To: Zeus Odin
Cc: [EMAIL PROTECTED]
Subject: Re: A very anno
t: Wednesday, January 29, 2003 10:06 AM
To: [EMAIL PROTECTED]
Subject: Re: A very annoying regex question.
From: Zeus Odin <[EMAIL PROTECTED]>
> I have spent a very LONG time trying to determine why this script is
> not splitting properly only on lines that have equals marks and on
Robert Citek wrote:
>
> Hello Zeus,
>
> At 11:55 AM 1/29/2003 -0500, Zeus Odin wrote:
> >An even shorter version of yours is:
> >-
> >my @a;
> >while(){
> > next unless /=/ && chomp;
> > push @a, split /=/, $_, 2;
> >}
> >print "$_\n" for @a;
> >---
Hello Zeus,
At 11:55 AM 1/29/2003 -0500, Zeus Odin wrote:
>An even shorter version of yours is:
>-
>my @a;
>while(){
> next unless /=/ && chomp;
> push @a, split /=/, $_, 2;
>}
>print "$_\n" for @a;
>-
This is even shorter, eliminates all uses
Hello, Robert. Thanks for the reply.
An even shorter version of yours is:
-
my @a;
while(){
next unless /=/ && chomp;
push @a, split /=/, $_, 2;
}
print "$_\n" for @a;
-
This avoids the temp @f. However, that's just it. I wanted to avoid
proc
Hello Zeus,
At 09:49 AM 1/29/2003 -0500, Zeus Odin wrote:
>I have spent a very LONG time trying to determine why this script is not
>splitting properly only on lines that have equals marks and only on the
>first equals.
I'm not quite sure what you are trying to do. So below is a modified
versio
From: Zeus Odin <[EMAIL PROTECTED]>
> I have spent a very LONG time trying to determine why this script is
> not splitting properly only on lines that have equals marks and only
> on the first equals. This would be very easy if I didn't slurp in the
> entire file at once, but hey life usually isn't