I'm wondering what is the least resource intensive way to read just one
item of a file.  I'm looking at one of two options (I'm assuming there are
more that I'm just not familiar with).  The first idea is to run grep
through a system command.  The second is to open the file for reading then
scan each line for the matching text.

my $thing = `grep "text" file`;

my $file = 'file';
my $FH;
open($FH, '<', $file);
for <FH>
{
  if m/(thing)/
  { $thing = $1 }};

I know its basic code with a lot of stuff missing, but I think you get the
idea.  Is there another method that might be even cheaper than these two?

Thanks,
Sheppy

Reply via email to