( categories: working with files )
Pass a reference to the filehandle. The syntax is \*FH, where FH is the filehandle you want to pass as a parameter.
Example:
#!/usr/bin/perl
open FILE, ">/tmp/file.txt";
print FILE "Header\n--------------------\n";
#-- pass a reference of the filehandle to 'write_body'
write_body(\*FILE);
close FILE;
sub write_body
{
$FILE = $_[0];
print $FILE "this is the body\nof this file\n";
}





