kevind0718 has asked for the wisdom of the Perl Monks concerning the following question:
I want to create a subroutine that prints a "standard" header that I need for text files. I would like to pass the FILEHANDLE in to this subroutine.
This works.
I tried the following:
Thanks in Advance.
kd
This works.
I would like to pass in the file handle (RM3DFile).open (RM3DFile, ">", $fullFileName ) || die("Could NOT open " . $ful +lFileName . "\n"); rm3dHeader(RM3DFile); close RM3DFile; # RM3D File header sub rm3dHeader($) { print RM3DFile "START_OF_FILE\n"; print RM3DFile "\n"; print RM3DFile "DATEFORMAT=YYYYMMDD\n"; print RM3DFile "DECIMALSEPARATOR=. \n"; }
I tried the following:
but got compile errorsopen (RM3DFile, ">", $fullFileName ) || die("Could NOT open " . $ful +lFileName . "\n"); rm3dHeader(RM3DFile); close RM3DFile; # RM3D File header sub rm3dHeader($) { print $_[0] "START_OF_FILE\n"; print $_[0] "\n"; print $_[0] "DATEFORMAT=YYYYMMDD\n"; print $_[0] "DECIMALSEPARATOR=. \n"; }
Thanks in Advance.
kd
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: passing a file handle to a subroutine
by rhesa (Vicar) on Sep 04, 2007 at 18:50 UTC | |
by kevind0718 (Scribe) on Sep 04, 2007 at 19:15 UTC | |
Re: passing a file handle to a subroutine
by Fletch (Bishop) on Sep 04, 2007 at 19:09 UTC | |
Re: passing a file handle to a subroutine
by graff (Chancellor) on Sep 05, 2007 at 04:36 UTC | |
by Anonymous Monk on May 01, 2010 at 16:47 UTC | |
Re: passing a file handle to a subroutine
by blazar (Canon) on Sep 06, 2007 at 12:02 UTC | |
Re: passing a file handle to a subroutine
by Comyn (Initiate) on Sep 05, 2007 at 17:50 UTC |
Back to
Seekers of Perl Wisdom