in reply to Using a Variable as a Match Expression

quotemeta or \Q..\E will fix your problem with special characters if you want to use a regex. Should probably add some boundary requirements though as well:
foreach $line (@list_of_files){ if ($line =~ /^\Q$find_file\E\s/){ print ($line); } }

Replies are listed 'Best First'.
Re^2: Using a Variable as a Match Expression
by Anonymous Monk on Feb 16, 2011 at 18:54 UTC
    Thanks!