in reply to Re: undef==defined sometimes? (body question)
in thread undef==defined sometimes?
If I'm "in" the function, and I return an array to a scalar won't perl coerce the array into a scalar length and assign that to my scaler instead? So I'll end up with either the number of elements in the array, or 'unef', but not the array?
Seems like this is pushing me in the direction of not being able to return an array with a list of found values or 'undef' ... I think I 'resent' the syntax that @a=1, is an assignment to $a[0]...I can understand why it happens, but I'm not sure how useful it is given that by using the "@" and no index, I'm only wanting an array to be assigned. It seems a perversity to coerce undef into a defined array with value undef in the first element....
Under what situations is this commonly useful? Or are there too many to number? Sigh. ...
If I want to return 'undef' and have it be interpreted as an undef array, then I need to return ()....a bit of a pain, since I wanted higher level routines to not care about the type of a return unless they needed to use it, with undef always being 'undef'.....
Just seems to complicate matters a bit.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: undef==defined sometimes? (body question)
by ysth (Canon) on May 03, 2008 at 00:56 UTC | |
|
Re^3: undef==defined sometimes? (body question)
by chromatic (Archbishop) on May 03, 2008 at 05:33 UTC | |
by Anonymous Monk on May 05, 2008 at 00:33 UTC | |
|
Re^3: undef==defined sometimes? (body question)
by ikegami (Patriarch) on May 03, 2008 at 00:43 UTC | |
|
Re^3: undef==defined sometimes? (body question)
by parv (Parson) on May 03, 2008 at 00:25 UTC | |
by perl-diddler (Chaplain) on May 03, 2008 at 11:14 UTC | |
by ikegami (Patriarch) on May 03, 2008 at 11:29 UTC |