foreach my $index (0 .. $#bits) { print "$device1_status[$index]\n" if ( $bits[$index] ); }