#!/usr/bin/perl use strict; use warnings; my @re; open(my $fh,"<$ARGV[0]") or die $!; while(<$fh>){ chomp; s/\*/.*/g; push(@re,$_); } close $fh; for(@re){ print "yes" if('Test' =~ /^$_$/); }