R
Robert
Hello,
I am trying to create different files to print data to.
The problem I am having is with the name of the file.
I have created a loop to create the files, which works fine,
however later in the program I need to write similar data to the file.
This is what I am doing but it does not work:
while ($group <=12){
print MY.$group.OUTFILE $header_top;
print MY.$group.OUTFILE "$group";
print MY.$group.OUTFILE "$header_bottom;
$group++;
}
How can I get the "reference to the file" to change name?
At the moment I am forced to type:
$group = "12";
print MY12OUTFILE $header_top;
print MY12OUTFILE "$group";
print MY12OUTFILE $header_bottom;
$group = "11";
print MY11OUTFILE $header_top;
..............
..............
Any suggestions?
I am trying to create different files to print data to.
The problem I am having is with the name of the file.
I have created a loop to create the files, which works fine,
however later in the program I need to write similar data to the file.
This is what I am doing but it does not work:
while ($group <=12){
print MY.$group.OUTFILE $header_top;
print MY.$group.OUTFILE "$group";
print MY.$group.OUTFILE "$header_bottom;
$group++;
}
How can I get the "reference to the file" to change name?
At the moment I am forced to type:
$group = "12";
print MY12OUTFILE $header_top;
print MY12OUTFILE "$group";
print MY12OUTFILE $header_bottom;
$group = "11";
print MY11OUTFILE $header_top;
..............
..............
Any suggestions?