- or download this
sub your_function {
...
# Either way we don't need it any more.
close OUTFH;
}
- or download this
your_function( $string, \*INPUT, '/tmp/somefile' );
- or download this
# print to STDOUT instead of to disk
your_function( $string, \*INPUT, "&STDOUT" );
...
open OUTPUT, '> /tmp/somefile'
or die "/tmp/somefile: $!\n";
your_function( $string, \*INPUT, "&OUTPUT" );
- or download this
open OUTFH, ">$out" or die "$out: $!\n";
- or download this
# wrong: given, eg, &STDOUT, creates a file named '&STDOUT'
open OUTFH, "> $out" or die "$out: $!\n";
# wrong: also creates, eg, '&STDOUT'
open OUTFH, '>', $out or die "$out: $!\n";