#!/usr/bin/perl -w use strict; sub FOO { return qw($bar $foobar); } my $foo = '$bar'; print "It matched!\n" if (grep /$foo/, FOO());