| August 1999 | Return to the Perl Hardware Store | Slide #19 |
A reference used like a string is stringized
It now looks like HASH(0x436c2d) or some such.
The 0x436c2d part is the address of the actual data
So eq will compare references also (slower than ==)
sub unique_objects {
my (%seen, @result);
for my $obj (@_) {
push @result, $obj unless $seen{$obj}++;
}
@result;
}
This is why you should not say
function("$x");
| Next | ![]() |
Copyright © 1999 M-J. Dominus |