my @masters = qw/ John Paul George Ringo /; #### use strict; my @masters = qw/ John Paul George Ringo /; sub is_master { my $who = shift; return scalar grep /^$who$/, @masters; } for (qw/ John George James /) { if (is_master($_)) { print "$_ is master\n" } else { print "$_ is not master\n" } } #### John is master George is master James is not master