in reply to passing a file handle to a subroutine
open( OUTPUT, ">", "some.file" ) or die "$!"; print OUTPUT rm3dHeader(); print OUTPUT rm3dData(); close OUTPUT; sub rm3dHeader { return "START_OF_FILE\n\nDATEFORMAT=YYYYMMDD\nDECIMALSEPARATOR=.\n +"; } sub rm3dData { return "this is the data\n"; }
This would provide some flexibility that might be handy, and generally helps to keep the "make_header" logic independent from the "create/write/close file" logic.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: passing a file handle to a subroutine
by Anonymous Monk on May 01, 2010 at 16:47 UTC |