The way i tried one way (here i have changed subroutine name as per the key in the hash, which i don't want): for (sort keys %po) { $input = &$_ ($input); }