my @a1 = qw(My name is Andrew); my @a2 = qw(My dog named Andrew); #### foreach my $a1 (@a1){ $i++; #print $a1 . "\n"; } #### First:for($a = 0; $a <= $i; $a++){ Second:for($s = 0; $s <= $i; $s++){ my $d = 0; print $a.$t; print $s.$n; if($a!=$s){ print "Yes.->".$a.$s.$n; last} print "system command \$a $a, then for \$s $s".$n; $d++; } } #### use strict; use warnings; my @a1 = qw(My name is Andrew); my @a2 = qw(My dog named Andrew); my $i = 0; while ($a1[$i] and $a2[$i]) { # make sure something is in both arrays if ($a1[$i] ne $a2[$i]) { print "system command \$a1 $a1[$i], then for \$a2 $a2[$i]\n"; } else { print "# \$a1 $a1[$i], and \$a2 $a2[$i] are the same\n"; } $i++; }