in reply to passing multiple items to a subroutine

Other way would be using prototypes. In this case you should write it like this.
# instead of # sub print_graph # try this sub print_graph (\@\@$$)
This also helps, to make sure your calls to this subroutine are correct. Also your scalars would come as scalars to get them as references add '\' infront of '$'.