use strict; use warnings; my $userinput = 'Blah'; while (my $record = ) { print "Matched user input against $record" if $record =~ m/$userinput/g; } __DATA__ Blegh Blah <- that should match blah <- and that won't Yuck #### Matched user input against Blah <- that should match