for ( 0..7 ) { my $Col = $_; # Eek! Save $_ otherwise this value is lost for ( 0..7 ) { # Do something in an 8x8 matrix. if ( $Matrix[ $Col ][ $_ ] == 4 ) ... } }