#!/usr/bin/perl use strict; my $testdata = 'This is a foo bar test'; while ( my $testregex = ) { chomp $testregex; my $result = ( $testdata =~ /$testregex/ ) ? "matched" : "did not match"; print "Test data $result $testregex\n"; } __DATA__ foo o{1,2} \w{5,10} \w{1,5} \d bar