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 easy. The array @a > should always have an equal number of elements. I have tried countless > permutations with no luck. Thanks. > > In case the email formatting gets messed up, there are 8 lines beneath > __DATA__. > > #!/usr/bin/perl -w > use strict; > > undef $/; > my @a = grep length, split /\[.*\]|^(?:[^=]+)=|\s+/i, <DATA>;
my @a = map {split (/\s*=\s*/, $_, 2)} split(/\r?\n/, <DATA>); > 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 Sometimes it's better to do one thing at a time :-) Jenda P.S.: Are you sure you do not want to use Config::IniHash qw(ReadINI); $config = ReadINI(\*DATA); print $config->{DEFAULT}->{BASEURL},"\n"; ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]