First off add strictures (use strict; use warnings; - see The strictures, according to Seuss) to your code then fix up the issue with $cost in the nested foreach loop.
Aside from that, if I run your code with the data you have provided it prints:
5 Not a HASH reference at C:\Users\Peter\Delme~~\PerlScratch\noname.pl . +..
The line involved in the error is:
push @{${$to}{Edges}}, $edge;
This is not the result you indicate so either the data provided or the code sample you give is not what you actually tested.
The immediate issue with the sample provided is that your print ... {"Bellaire"}... line autovivifies the Bellaire %verts entry as an array when it should be a hash.
It may help if you tell us what you are trying to achieve. It is pretty near impossible to tell that from the code and given the code doesn't work ...
In reply to Re: hashref scope
by GrandFather
in thread hashref scope
by Trotskey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |