sub new_packages { my $fcount = shift; # use shift instead of $_[0] my $packages_ref = shift; # use shift instead of $_[1] print "Found $fcount packages for download: $_\n" if $fcount > 1); print "Found $fcount package for download: $_\n" if $fcount == 1); print "Which one would you like to install?:\n"; foreach my $key (keys %{$packages_ref}) { print "$key) $packages_ref->{$key} \n"; } }