Tuesday, May 22, 2012

How to assign a file handle to a subroutine.
==============================

my $FH;
open($FH,"< /tmp/text");
my_print(\*$FH);
exit(0);
sub my_print {
    my $FH = shift;
    my @arr = <$FH>;
    print @arr;
}

2 comments:

  1. yup :) globbing, but do we really need to escape globber?

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete