On Fri, Jan 11, 2013 at 11:05 AM, budi pearl <budipe...@gmail.com> wrote:

> Hi Shawn,
>
> When trying to accessed inside subroutine , i got:
>
> Type of arg 1 to each must be hash (not hash element) at ./print_path.plline 
> 41, near "}) "
>
> Execution of ./print_path.pl aborted due to compilation errors.
>
>
> this is work:
>   while (my ($start, $end) = each %{$routes{$label}}) {
>
> but this not:
>     while (my ($start, $end) = each %{$edges{$label}}) {
>
>
>
This will work, but this will pass %routes instead of %routes{$id}. Or it
should be that way?

my $hroute = \%routes;
print_path($id, $hroute);

...
while (my ($start, $end) = each %{$edges->{$label}}) {

Reply via email to