Hello, Robert. Thanks for the reply. An even shorter version of yours is: ------------------------- my @a; while(<DATA>){ 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 processing DATA one line at a time, which is what you are doing. I wanted to (1) slurp in DATA entirely and (2) then split on the first '=' in ONLY lines containing equals marks. This means throwing away white space and any lines not containing an equals mark. These criteria make the regex a bit more complex. The entity ^(?:[^=]+)= should split lines containing any equals on the first equals. Everything I've read agrees, but it does not work. C'est la vie. On Wed, 2003-01-29 at 10:52, Robert Citek wrote: > > 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 > version of your script which may shed some light on what is happening. > > Regards, > - Robert > > ----- > #!/usr/bin/perl -w > use strict; > > # undef $/; > > while (my $line=<DATA>) { > chomp $line; > print "=> $line\n"; > my @f = split(/\[.*\]|^(?:[^=]+)=|\s+/i, $line); > print "==> @f\n"; > my @a = grep(length, @f); > print "===> $_\n" for @a; > } > > __DATA__ > [DEFAULT] > BASEURL=http://v4.windowsupdate.microsoft.com/en/default.asp > [DOC#17#19#21] > BASEURL=http://v4.windowsupdate.microsoft.com/en/splash.asp?page=3&x86=true& > auenabled=false& > ORIGURL=splash.asp?page=0&corporate=false& > [InternetShortcut] > URL=http://v4.windowsupdate.microsoft.com/en/default.asp > Modified=B059DD590A4BC20157 > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]