sub purge_this_one { my $aref = $_[0]; my $searched = $_[1]; my $idx = first_index { $_ == $searched } @$aref; return @$aref if $idx == -1; splice( @$aref, $idx, 1 ); return @$aref; }