in reply to If you believe in Lists in Scalar Context, Clap your Hands
Finally, and for extra points (and points mean prizes), how does one describe the difference between a list and an array ?
That's not that hard. Anything that you can push onto is an array, all other things that look like arrays or lists are actually lists. (Any array method that changes the length works as a probe instead)
Examples for Arrays:
@array # this works: push @array, $item;
Examples for Lists:
# things returned from subs: localtime(); # slices: @INC[0,1,-1]; # literals qw(foo bar); # return values from operators ('12') x 10; # you can't push() on any of these - and it wouldn't make sense anyway
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: If you believe in Lists in Scalar Context, Clap your Hands
by gone2015 (Deacon) on Oct 23, 2008 at 19:31 UTC | |
by ikegami (Patriarch) on Oct 24, 2008 at 02:46 UTC | |
by moritz (Cardinal) on Oct 23, 2008 at 19:34 UTC | |
by ikegami (Patriarch) on Oct 24, 2008 at 02:54 UTC | |
by ysth (Canon) on Oct 28, 2008 at 04:51 UTC | |
by ikegami (Patriarch) on Oct 28, 2008 at 10:21 UTC | |
by JavaFan (Canon) on Oct 28, 2008 at 11:05 UTC | |
|