use strict; use warnings; use 5.010; use Mapx; sub x { my $target = shift; mapx { return DONE_MAP if $_ == $target; $_ } @_; } say for x( 5, 1..9 );