in reply to Re: perlsub question..
in thread perlsub question..
If no return is found and if the last statement is an expression, its +value is returned. If the last statement is a loop control structure +like a foreach or a while, the returned value is unspecified. The emp +ty sub returns the empty list.
the last two sentences look wrong to me. tried this:
D:\>perl -MData::Dumper -e "sub x{1 for 1..5};@y=x();print 'ha' if def +ined @y" ha
so the return value is certainly defined.
The empty sub returns the empty list. that depends on what it's return context is though, not necessarily a empty list..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perlsub question..
by naikonta (Curate) on Jun 23, 2007 at 19:19 UTC | |
|
Re^3: perlsub question..
by Jenda (Abbot) on Jun 23, 2007 at 18:50 UTC | |
|
Re^3: perlsub question..
by shmem (Chancellor) on Jun 23, 2007 at 20:22 UTC |