The construct sub BLOCK creates an anonymous sub (aka a code reference or "coderef"); it doesn't call the created sub in any fashion (you'd need to do something along the lines of (sub {$str =~ /abc/})->() using your example). As the coderef is always a logically true value the test always passes.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: Return value of a sub
by Fletch
in thread Return value of a sub
by elTriberium
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |