100110000000.... #### @device1_status = qw ( Enabled Critical_fault Warning_fault Voltage_level_1_on Voltage_level_2_on . . . ); #### foreach my $index (0 .. $#bits) { print "$device1_status[$index]\n" if ( $bits[$index] ); } #### %status = { 'dev1' => [ qw( enabled crit_fault warning_fault . . ) ], 'dev2' => [ qw( power_on OV_condition UV_condition phase_fault . . ) ], };