#!/user/bin/perl -w use strict; my $x = []; #assigns $x to an anonmyous list my $y = []; #assigns $y to an anonmyous list if ($x == $y) { print "x and y are the same reference *1\n"; } else { print "x and y are NOT the same reference *2\n"; } $y = $x; #assigns address x to y if ($x == $y) { print "x and y are NOW the same reference *3\n" } else { print "x and y are different! *4 \n"; } __END__ PRINTS: x and y are NOT the same reference *2 x and y are NOW the same reference *3
In reply to Re: checking reference equality
by Marshall
in thread checking reference equality
by perl5ever
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |