Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Parsing Challenge

by MeowChow (Vicar)
on May 25, 2001 at 05:49 UTC ( [id://83208]=note: print w/replies, xml ) Need Help??


in reply to Parsing Challenge

I'm partial to these methods:
my %hash = split /=|\b(?=\S+=)/, $data; $hash{$_} = [ split / /, $hash{$_} ] for keys %hash;
or
my %hash; $hash{$1} = [split / /, $2] while $data =~ /(\S+)=(.*?)(?=\S+=|$)/g;
or to support repeated keys:
my %hash; push @{$hash{$1}}, split / /, $2 while $data =~ /(\S+)=(.*?)(?=\S+=| +$)/g;
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://83208]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-28 18:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found