#!/usr/bin/env perl use strict; use warnings; use Getopt::Long; # our constants use constant ABA => 0b00001; # 0b... for binary number use constant SCO => 0b00010; use constant ACC => 0b00100; my $a = 0b0; Getopt::Long::GetOptions( 'ABA' => sub { $a |= ABA }, 'SCO' => sub { $a |= SCO }, 'ACC' => sub { $a |= ACC }, ) or die "error command line"; if( $a & SCO ){ print "it has SCO!\n"; } if( $a & ABA ){ print "it has ABA!\n"; } if( $a & ACC ){ print "it has ACC!\n"; }