note
crouchingpenguin
<p>Give this a try:</p>
<code>
#!/usr/bin/perl
use strict;
use warnings;
use Tie::File;
my @file;
tie @file, 'Tie::File', '/tmp/filename'
or die "Failed to tie file: $!";
foreach my $matching_line ( grep { m/^myLine/ } @file ){
$matching_line =~ s/^myLine/this_was_a_match/;
}
</code>
<br>
<a href="http://www.perlmonks.org/index.pl?node_id=197321">cp</a><br>
----<br>
"Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."
282853
282853