in reply to Re: array in hashes
in thread array in hashes
i am sorry,i am new in perl.i got it,but if i wrote the following code ,because i need the values for each key, error is about arrays.i haven't gotten this!
#!/usr/bin/perl -w use strict; my %genome1 = ( a => [ 10, 15 ], b => [ 3, 7 ], c => [ 9, 14 ], ); my %genome2 = ( d => [ 3, 21 ], a => [ 3, 4 ], g => [ 5, 10 ], b => [ 2, 7 ], ); for (keys(%genome1)) { if ($genome2{$_}) { print("$genome1{$_} and $genome2{$_}\n"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: array in hashes
by moritz (Cardinal) on Jul 29, 2011 at 09:18 UTC | |
by persianswallow (Novice) on Jul 29, 2011 at 09:36 UTC | |
by moritz (Cardinal) on Jul 29, 2011 at 09:54 UTC | |
by fisher (Priest) on Jul 29, 2011 at 10:07 UTC | |
by JavaFan (Canon) on Jul 29, 2011 at 10:19 UTC | |
by AnomalousMonk (Archbishop) on Jul 29, 2011 at 15:37 UTC | |
by fisher (Priest) on Jul 29, 2011 at 14:02 UTC | |
| |
by persianswallow (Novice) on Jul 29, 2011 at 10:44 UTC |