Next | The Perl Hardware Store | DC.pm Version | 56 |
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 © 2003 M. J. Dominus |