Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Match integer or floating point numbers, then parse triplets

by metaperl (Curate)
on Sep 14, 2011 at 19:08 UTC ( [id://925981]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # have $1 contain everything but the leading "0:"
    # and the trailing ",$intOrFloat" ... in this case ",4.00"
    ...
    
    $_  = "0:20,1.00,g,1.00;65,4.00,g,4.00";
    /0:(.)+,$intOrFloat/ and warn $1;
    
  2. or download this
    # $1 contains a series of triplets separated by semicolons
    # Each triplet consists of price,quantity,unit_of_measure
    # The goal is to create an array of hashrefs with this data:
    # { price => ..., quantity => ..., unit_of_measure => ... }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-25 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found