The way you wrote it, no (real) difference, 'cause you're just accessing the values in $x1 and $x2. If, on the other hand, you were doing something like incrementing one of them, they are *very* different.
The logical AND is lazy. By that I mean when perl is doing the test, if the first half evaluates to false, the second half doesn't get evaluated at all. It can get you into trouble if you don't know to expect it.
In method #2 below, the $x1 gets incrmented and $x2 doesn't.
#!/usr/bin/perl
use strict;
my $x1 = 1;
my $x2 = 1;
print "\$x1 starts as $x1 and \$x2 starts as $x2.\n";
# method 1
if ($x1++) {
if ($x2++) {
print "We incremented \$x1 to $x1 and \$x2 to $x2.\n";
}
}
undef $x1;
undef $x2;
print "Undefine them both...\n";
#method 2
if ($x1++ && $x2++){
print "Shouldn't ever get here!\n";
}
print "Now, we incremented \$x1 to '$x1' and \$x2 is still '$x2'.\n";