map { ...code here... } @array #### # Predeclaration sub partition($\@); ... sub partition($\@){ my ($coderef, @array) = @_; # Do something with these variables }