Help for this page

Select Code to Download


  1. or download this
    perl -mstrict -we "my @arr=(1,2,2);print 'both' if [2,2] ~~ @arr[1,2]"
    both
    
  2. or download this
    perl -mstrict -we "my @arr=(1,2,2);print 'exactly two' if (grep{$_==2}
    +@arr) == 2"
    exactly two