in reply to Re^3: 'return:' instead of 'return'
in thread 'return:' instead of 'return'
also prints 3, but I assume the die is not executed because the subroutine has exited, not because the 'return' did not evaluate to true. I can't think of an example which would clearly show the difference (between what return evaluates to and what the subroutine evaluates to) maybe because there really isn't a difference?perl -wE 'sub fn{ return 3 and die("bury me where this arrow lands") } + say fn'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: 'return:' instead of 'return'
by jethro (Monsignor) on Jun 12, 2009 at 11:04 UTC | |
by Boldra (Curate) on Jun 12, 2009 at 11:58 UTC | |
by jethro (Monsignor) on Jun 12, 2009 at 13:34 UTC | |
|
Re^5: 'return:' instead of 'return'
by JavaFan (Canon) on Jun 12, 2009 at 12:10 UTC | |
by Boldra (Curate) on Jun 12, 2009 at 12:21 UTC | |
by Corion (Patriarch) on Jun 12, 2009 at 12:31 UTC | |
by Zen (Deacon) on Jun 12, 2009 at 15:49 UTC | |
by JavaFan (Canon) on Jun 12, 2009 at 16:04 UTC |