in reply to Search for account number in a file name

After fixing the compile error (I assume you meant \b/), and running the code, you get "No match". If you want to match, you should get rid of the \b
use warnings; use strict; my $filename = "000776654103_01_QY_20099976_776520.txt"; my $account = "7766541"; if ($filename =~/$account/) { print $filename."\n"; }else{ print "No match for $account\n"; } __END__ 000776654103_01_QY_20099976_776520.txt

See also: