Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How to Map Regex to Hash

by TedPride (Priest)
on Jul 01, 2006 at 01:05 UTC ( [id://558712]=note: print w/replies, xml ) Need Help??


in reply to How to Map Regex to Hash

Split doesn't work here - the edge cases don't process properly. japhy had the correct answer:
use strict; use warnings; use Data::Dumper; chomp($_ = <DATA>); my %rec; $rec{$1} = $2 while m/(\d+),"(.*?)"/g; print Dumper(\%rec); __DATA__ 0,"104"1,"Assign Tracking Numb"29,"905745371116"526,"0201"99,""

Replies are listed 'Best First'.
Re^2: How to Map Regex to Hash
by CountZero (Bishop) on Jul 01, 2006 at 08:10 UTC
    What edge case where you thinking of?

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (1)
As of 2024-04-25 00:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found