Hi,

I have this following hash:

#!/usr/bin/perl
#
use strict;
use Data::Dumper;

my %MYROUTES = (
    "ROUTE-252" => {
    #  src => dest
       427 => "ABEP",
       "ABEP" => 441,
       441 => 427,
       427 => 444,
       444 => "MGWQ",
       "MGWQ" => "CDEF"
    },

    "ROUTE-432" => {
       "AAA" => "BBB",
       "BBB" => "CCC",
       "CCC" => "DDD",
       "XXX" => "YYY",
       "YYY" => "ZZZ"
    }
);

print Dumper %MYROUTES;

__END__

Expected results:

ROUTE-252: 427 - ABEP - 441 - 427 - 444 - MGWQ - CDEF
ROUTE-432: Error: can not follow the route!

or if possible can be more specific on how many link founds:
Error, some path is missing:
ROUTE-432: AAA - BBB - CCC -DDD
ROUTE-432: XXX - YYY -ZZZ

I put data in order for brevity, actual data may not.

Can someone shed some light how to find head then follow the path as above?
Many thanks.

--budi

Reply via email to