I have some code here. But I don't think it's working.
my $answer = grep (/$A'\t'$B/, $file);
Alternatively I tried
my $answer = system( "grep $A'\t'$B, $file);
The first one doesn't print anything, and the second one prints out the actual grepped line to the console. However, $answer remains
My goal is grep lines out of a file. I know there should only be 1 match. I would like to save the line from $file that matches the "$A\t$B" to the variable $answer. I was wondering how I would do that without reading the whole file in. But if I read line by line, I think that would be inefficient time-wise, because here I will be doing that multiple times. I'm afraid of memory issues if I read the entire file in.
Any thoughts?