mndoci has asked for the wisdom of the Perl Monks concerning the following question:
However this gives me something of the form#!/usr/bin/perl -w # the goal of this script is to change test in line 1 of files to test + 1.0 my $txtfile; #while (<*.TXT>){ foreach $txtfile (glob("*.TXT")) { print $txtfile; print "\n"; open FILE, "$txtfile"; open NEWFILE, ">$txtfile.tmp"; while (<FILE>){ if ($. == 1){ $_ =~ s/$_/$_ 1.0/g; } print NEWFILE $_; } close FILE; close NEWFILE; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: appending to a particular line in a file
by dvergin (Monsignor) on Aug 03, 2001 at 02:30 UTC | |
by mndoci (Scribe) on Aug 03, 2001 at 02:37 UTC | |
|
Re: appending to a particular line in a file
by mndoci (Scribe) on Aug 03, 2001 at 02:00 UTC |