use warnings; use strict; use 5.10.0; my $ext = 'jpg'; given ($ext) { when (qw/jpeg jpg png/) { print "ok\n"; } default { print "not ok\n"; } }