in reply to Passing filehandle to sub
And if you need to revert back to previous positions in the file make use of the tell and seek functions.## bareword open open(FH, "yourfile") or die("oops - $!"); func_call( *FH ); ## variable open open(my $fh, "yourfile") or die("oops - $!"); func_call( $fh ); sub func_call { my $fh = shift; do_stuff($_) while <$fh>; }
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing filehandle to sub
by arthas (Hermit) on Jun 09, 2003 at 12:27 UTC | |
by broquaint (Abbot) on Jun 09, 2003 at 13:23 UTC | |
by bobn (Chaplain) on Jun 09, 2003 at 22:17 UTC | |
by Mr. Muskrat (Canon) on Jun 09, 2003 at 13:34 UTC | |
by sauoq (Abbot) on Jun 09, 2003 at 21:41 UTC | |
|
Re: Re: Passing filehandle to sub
by marctwo (Acolyte) on Jun 09, 2003 at 13:19 UTC |