use strict; use vars qw($program); $program={}; #### sub main { my $program; ... $program={}; parse_program("source.c", $program); print_functions($program); do_other_stuff($program); } #### sub print_functions { my $program=shift; # this is not needed if $program is # global, obviously my $functions=$program->{functions}; # and now you can just use $functions to access the data }