Next Tricks of the Wizards 27

Passing Filehandles

        $data = read_block(FH);        # Doesn't work
        package My::IO;
        sub read_block {
          my $fh = shift;
          my $buf;
          read $fh, $buf, $BLOCKSIZE;
          $buf;
        }
        $data = read_block(main::FH);
        $data = read_block(\*FH);


Next Copyright © 2003 M. J. Dominus