sub exists { my ($array, $value) = @_; return grep $_ eq $value, @$array; } exists( $arr_ref, $value ) ? 'yes' : ''