in reply to Re^4: A Better Way
in thread A Better Way

If it's only for the first line, use this instead:

use strict; use warnings; use Tie::File; tie my @xfil, 'Tie::File', 'var.txt' or die $!; $xfil[0] =~ s/the line to be replaced/this is the new line/; untie @xfil;

Substantially less cumber. :-)

-- Ken