#!/usr/bin/perl # mod2 Machine. use strict; use warnings; "112358" =~ /['0' | '2' | '4' | '6' | '8']$/i ? print "even\n" : print "odd\n"; # if we add 'A' | 'C' | 'E' to the list, it can handle hexadecimals as well.