in reply to How can I pass File_Handle to a subroutine?

Or try:

open (my $FH_01 , ">", "file_01.txt" ) || die "open failed $!"; &hash2file(\%hash_regs, $FH_01); # it should work

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

Replies are listed 'Best First'.
Re^2: How can I pass File_Handle to a subroutine?
by Hanken (Acolyte) on Jul 01, 2008 at 08:32 UTC
    Oh, thanks, it works. BTW: what is the difference between $FH_01 and <FH_01>? I feel the data structure of <FH_01> is very confusing.

      $FH_01 is a scalar variable that holds a filehandle, you can use it to access (read, write, stat) the file. <FH_01> is actually a call to the readline function on the FH_01 filehandle (not the same as the $FH_01 variable!).

      --
      David Serrano