artist has asked for the wisdom of the Perl Monks concerning the following question:
I am looking for a way, so that I don't have to use hash "Record". Random values are just for the demonstration purpose. Actual values contain many fields in records.#Search Results foreach (1..40){ my $hit = int rand(30); my $id = int rand(1000); push @results, "$hit:$id"; } @search_results = sort { $b <=> $a } @results; #Records my $Record; foreach (0..999){ my $data = int rand(100); # push @ids, "$_:$data"; $Record->{$_} = $data; } #Display foreach (@results){ my($hit,$id) = split /:/; my $data = $Record->{$id}; print "$hit $id $data\n"; }
(Note:Feel free to update the title). Thanks.!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Joining data structures.
by conrad (Beadle) on Dec 09, 2004 at 00:52 UTC | |
|
Joining data structures and not a hash in sight
by Random_Walk (Prior) on Dec 09, 2004 at 00:28 UTC | |
|
Re: Joining data structures.
by johnnywang (Priest) on Dec 09, 2004 at 00:16 UTC | |
|
Re: Joining data structures.
by runrig (Abbot) on Dec 09, 2004 at 00:12 UTC |