#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11163188 use warnings; use List::AllUtils qw( sample ); (sample 1, values %INTERNALFUNCTIONS::)->() for 1 .. 5; package INTERNALFUNCTIONS; sub TestSub1 { print "TestSub1\n"; } sub TestSub2 { print "TestSub2\n"; } #### TestSub1 TestSub2 TestSub2 TestSub1 TestSub1