in reply to searching using a scalar as pattern

Someone correct me if I am wrong, but wouldn't it be better to just read the file in a line at a time?
my @matched_line; open FILE, "<$inputFileName" or die "$!\n"; while (<FILE>) { push @matched_line, $_ if (/$name/); } close FILE;
I am relativley new to Perl so that may not work, but I thought I would throw it out there.