Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 ( #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
Node Status?
node history
Node Type: note [id://177351]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2019-07-19 15:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?