[za-pm] Introducing Darryl Trimming ... with a regex /x modifier problem

Francois Marais francois at busii.com
Mon May 2 12:53:06 PDT 2011


 concatenation binds more closely than ternary op and logical AND &&, so the
ternary is looking at the result of the concatenation (which evaluates to
true, see perlsyn manpage on 'Truth vs Falsehood') and not the match ,
whereas in the highlighted cases the match (between parens) is evaluated
first. See perlop manpage on how Perl looks at a statement.

The say function is expecting a list, so to get what you expect you need
something like:

say (( 'h e l l o' =~ /h e l l o/x )?'true':'false')

to get everything else to be evaluated and the result said

Otherwise I misunderstand the question... (first day back from holiday :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/za-pm/attachments/20110502/95edc99c/attachment.html>


More information about the Za-pm mailing list