my @corners = ( 1, 0, 0, 0 ); my $index = 0; ( $index <<= 1 ) |= $_ for @corners; print "$index\n";