But when EXPR is one of the below exceptional cases, it is used directly as a boolean:
- [...]
- a regular expression match, i.e. /REGEX/ or $foo =~ /REGEX/, or a negated regular expression match (!/REGEX/ or $foo !~ /REGEX/).
- [...]
It makes sense. It allows
given ($x) { when (/abc/) { ... } when (/def/) { ... } when (/ghi/) { ... } }
to mean
if ($x =~ /abc/) { ... } elsif ($x =~ /def/) { ... } elsif ($x =~ /ghi/) { ... }
In reply to Re^6: Smart enough for Smart Match??? (was "Understanding ...Given/When" )
by ikegami
in thread Understanding the benefit of Given/When ...
by LanX
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |