$num_elements = 4; @_ = ( list,of,elements,to,splice ); @spliced_list = # This map operates on the list of splices. # the left side of || should test something # most likely something in $_ and return # something (or call a sub) if the test is # successful, and if the test fails, it should # failover to the right side of the || which # returns (). map { func1($_) } # This map operates on the spliced elements. # Splicing the list removes those elements # from the list as a side affect. map { func2( [ splice(@_, 0, $num_elements) ] ) } # Since this snippet shows how to fold an array, # we only need to iterate over the count of # new elements. 0 .. (@_ / $num_elements);