in reply to Return value of a sub
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Return value of a sub
by elTriberium (Friar) on Jul 07, 2009 at 19:17 UTC | |
by Joost (Canon) on Jul 07, 2009 at 19:31 UTC |