http://qs1969.pair.com?node_id=1033077

bh_perl has asked for the wisdom of the Perl Monks concerning the following question:

hi

i have main perl program called main.pl. The program will called openfile module to open/create new output file and writefile module to write contents into output files.

But how could i write all the contents into output files in writefile module ?. My sample program as below:

This is MAIN.PL

#!/usr/bin/perl use lib '/tmp/bh'; use openFile qw/openfile/; use writeFile qw /writefile/; openfile; writefile; close (TEST);

This is openfile module

package openFile; use base 'Exporter'; our @EXPORT_OK = qw/openfile/; sub openfile { open (TEST, ">/tmp/bh/output/test.txt"); print (TEST "FILE HEADER\n"); } 1;

This is writefile module

package writeFile; use base 'Exporter'; our @EXPORT_OK = qw/writefile/; sub writefile { printf (TEST "This is for testing only\n"); } 1;