in reply to hashref scope
Without knowing what your data structure looks like it is difficult to say how your code should look like. What I can tell you is that your code looks ok at first glance but is hard to read
Instead of writing ${$other}{Cost} you could write $$other{Cost}, or even better $other->{Cost}
Do you know about Data::Dumper ? It is an excellent tool to print complicated data structures for debugging. Just add 'use Data::Dumper' at the beginning of your script and you can print out complicated arrays or hashes with print Dumper(\%somehash); or references with print Dumper($referencetosomehash);
UPDATE: A short test of your complete script brought an error message: Not a HASH reference at ./t7.pl line 12, <> line 8.. Also I don't see where you initialize %verts with any data before you try to access it in line 10.
|
|---|