in reply to hash problems
This is a reference for a hash. You can now get your values back as:my $ptr; for ( my $i = 0; $i < @numbers; $i++ ){ $ptr->{$i}->{ number } = $numbers[$i]; $ptr->{$i}->{ sign } = $signs[$i]; }
This is not tested but should work. It uses references to a hash. Alternatively you might want to make $i part of the keys:while (@new_numbers){ my $i = $_; if ( defined $ptr->{$i} ){ print $ptr->{$i}->{ sign }.$ptr->{$i}->{ number }."\t".$i; } }
But it would be much more complicated sorting the keys out. Hope this is what you wanted.$hash{ $numbers[$i].":".$i } = $signs[$i];
|
|---|