in reply to Re: Passing regex result into function
in thread Passing regex result into function
The m// operator returns false (the empty string), not undef, on match failure when evaluated in scalar context:
Please see Regexp Quote-Like Operators.c:\@Work\Perl\monks>perl -wMstrict -le "my $str = 'abc'; PassRegex(scalar($str =~ /x/i), 'parm2', 'parm3'); ;; use Data::Dumper; ;; sub PassRegex { print Dumper(\@_); print qq{BoolExpr = '$_[0]' parm2 = '$_[1]' parm3 = '$_[2]'}; return; } " $VAR1 = [ '', 'parm2', 'parm3' ]; BoolExpr = '' parm2 = 'parm2' parm3 = 'parm3'
Give a man a fish: <%-{-{-{-<
|
|---|