in reply to The philosophy behind element reference syntax
It's all changing the context you are in, you can reference an element as @foo[$i] or $foo[$i], it's just an array slice of one (Ie. array context) versus a single element (scalar context). Eg.
my @abcd = (1,2,3); print "@abcd" . "\n"; $abcd[0] = 4; @abcd[1] = 5; print "@abcd" . "\n"; $abcd[0] = (4, 5, 6); @abcd[1] = (4, 5, 6); print "@abcd" . "\n"; print @abcd . "\n"; __DATA__ 1 2 3 4 5 3 6 4 3 3
As you can see the simple assignments are the same, it's only when you get to a point where the context matters that it changes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Symbols are about denoting context
by revdiablo (Prior) on Dec 08, 2004 at 18:24 UTC |