Apologies for dragging us off-topic again...

Am I missing something obvious here?

#!/usr/bin/perl -w

use strict;

package Tie::Hash::Test;
use Tie::Hash;
use vars qw(@ISA);

@ISA = 'Tie::StdHash';

sub FETCH {
  print "wantarray is ", wantarray ? "true\n" : "false\n";
  return $_[0]->{$_[1]};
}

package main;

my %h;
tie %h, 'Tie::Hash::Test';

%h = (one => 1, two => 2);

my $scalar = $h{one};
my @array = $h{two};

This prints out "wantarray is false" on both accesses. To me, this implies
that Perl is doing something strange behind the scenes and is forcing the
FETCH call to always be in scalar context, when I'd expect the second call
to be evaluated in list context.

Any clues?

Dave...

-- 


The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged. If the reader 
of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  
If you have received this communication in error, please 
re-send this communication to the sender and delete the 
original message or any copy of it from your computer
system.

Reply via email to