J
johnd
Hello,
I need help to print static text to a file using a 'for' loop. My
program:
my textline1 = "This is text line one" ;
my textline2 = "This is text line two" ;
my textline3 = "This is text line three" ;
my $outfile = 'mytextfile.txt' ;
open(OUT, ">$outfile" ) or die "Cannot open for output: $!"
$count = 1 ;
while ($count <=3)
{
$printline = "$textline".$count ;
print OUT "$printline \n" ;
count ++ :
}
close OUT ;
I would expect the OUT file to contain the enrties:
This is text line one
This is text line two
This is text line three
But the OUT file contains the entries:
textline1
textline2
textline3
Please help me in understanding what I'm doing wrong.
Thank You!
I need help to print static text to a file using a 'for' loop. My
program:
my textline1 = "This is text line one" ;
my textline2 = "This is text line two" ;
my textline3 = "This is text line three" ;
my $outfile = 'mytextfile.txt' ;
open(OUT, ">$outfile" ) or die "Cannot open for output: $!"
$count = 1 ;
while ($count <=3)
{
$printline = "$textline".$count ;
print OUT "$printline \n" ;
count ++ :
}
close OUT ;
I would expect the OUT file to contain the enrties:
This is text line one
This is text line two
This is text line three
But the OUT file contains the entries:
textline1
textline2
textline3
Please help me in understanding what I'm doing wrong.
Thank You!