Nowadays it is customary to use the more secure 3 argument variant of open with a lexical filehandle. Also, you do not have to double quote your variables, unless you want to interpolate them into a string.
andopen my $READFILE, '<', $infile or die "Can not open $infile for parsi +ng: $!" ;
open my $WRITEFILE, '>', $outfile or die "Can not open new replacement + file: $outfile. $!";
Your loop will then be written as follows:
while (<$READFILE>) { # do something to $_ print $WRITEFILE $_ ; }
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial DeltronicsIn reply to Re: Newby question
by CountZero
in thread Newby question
by Parmenides
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |