Piers Cawley wrote: > Garrett Goebel <[EMAIL PROTECTED]> writes: > > > > What was the reason again which Larry rejected unifying the > > syntax for array and hash indexing? As Piers said, we know > > whether $a is an array or hash reference when we do: > > > > print $a->{foo}; > > But as someone else pointed out, there may be classes that have both > hashlike and arraylike interfaces. For instance: > > my $queue = SomeQueue.new; > > $queue.push('foo'); > $queue.push('bar'); > $queue.push('baz'); > > my $index_of_foo = $queue{'foo'}; # undef if no foo in queue.
And what's to prevent that collection object from handling: my $queue = SomeQueue.new; $queue.push('foo'); $queue.push('bar'); $queue.push('baz'); my $index_of_foo = $queue['foo']; # undef if no foo in queue. -- Garrett Goebel IS Development Specialist ScriptPro Direct: 913.403.5261 5828 Reeds Road Main: 913.384.1008 Mission, KS 66202 Fax: 913.384.2180 www.scriptpro.com [EMAIL PROTECTED]>