Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: What would be the easier way

by CountZero (Bishop)
on Mar 04, 2013 at 02:17 UTC ( #1021564=note: print w/ replies, xml ) Need Help??

in reply to What would be the easier way

I would do it this way:

use Modern::Perl; use Data::Dump qw/dump/; my %heights; while (<DATA>) { push @{$heights{$1}}, $3 if /set\s+height\s+"([^"]+)"\s*("([^"]+)" +)?/; } say dump(%heights); __DATA__ set height "house" set height "house" "5 meter" set height "house" "10 yards" set height "table" "80 cm" set height "table" "30 inch"
( "house", [undef, "5 meter", "10 yards"], "table", ["80 cm", "30 inch"], )


A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Comment on Re: What would be the easier way
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2015-11-25 21:59 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (691 votes), past polls