Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: A Better Way

by kcott (Archbishop)
on Nov 04, 2010 at 18:43 UTC ( [id://869541]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://869541]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-20 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found