Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: creating multiple views of a hash by reordering its key and values

by George_Sherston (Vicar)
on Jun 26, 2002 at 10:50 UTC ( [id://177351]=note: print w/replies, xml ) Need Help??


in reply to creating multiple views of a hash by reordering its key and values

Stop me if I'm saying something obvious, but does the plan of your script commit you to this data structure? - if not, would there be any merit in considering an array of hashes? - each hash having the three keys user, date, file. Then it would be easy to grep out the bits you want, e.g.
@results = grep { $_->{user} eq 'Fred' and $_->{date} >= 1023318000 and $_->{date} <= 1024182000 } @$userdatefile;
to get everything by Fred between the 6th and 16th of this month.

§ George Sherston

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-19 17:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found