### this file is called regex.pl my $testVar; $testVar = "January"; ### read this file open(FH,"; close(FH); ### make $pattern: $testVar $myself[2]=~/([^ ]+)/; my $pattern = $1; print "Pattern: $pattern\n"; ### print lines with this pattern for(@myself) { print if /$pattern/; }