in reply to Match all Odd and Even Numbers
What you have written is
foreach (@nums){ push (@even, $_) if /\/2/; #match strings that contain '/2' push (@odd, $_) if /^\/2/; #match strings that start '/2' } [download]
Try looking at the % (modulo) operator.