On Saturday 14 Dec 2002 6:22 am, christopher j bottaro wrote: > hello, > i want to make a sub that is to be used like this: > my @array; > open(INFILE, "blah"); > ParseOneItem (INFILE, \@array); > > i know how to pass the array reference, but how do i pass the file handle? > can i do it just like that? > > thanks, > christopher
Hi again Chris, Yes and no. You pass it as you show above, but then use it like a variable. Have a look at: [gary@gary gary]$ ./t1 #!/usr/bin/perl -w open(FIN,"<t1") || die "can't open myself: $!\n"; &readin(FIN); close(FIN); sub readin() { my ($HANDLE)=@_; print while(<$HANDLE>); } [gary@gary gary]$ -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]