in reply to writing files while reading files
If you're doing only simple conversions, then you don't need to put the formating in a subroutine; but it doesn't do any harm. --Dave.sub convert { scalar reverse shift } # whatever my $infile = "infile.txt"; my $outfile = "outfile.txt"; open IN, "<$infile" or die "can't read $infile: $!"; open OUT, ">$outfile" or die "can't write $outfile: $!"; while (<IN>) { print OUT convert($_); } close OUT; close IN;
|
|---|