in reply to Passing filehandle to sub
Anyway, if this is just a question regarding filhandle referencies, see the perlref and perlreftut. Also, I made a small example on filehandle referencing:
the testfile is simple:#!/usr/bin/perl -w open SESAME, "testfil"; while (<SESAME>) { chomp; print "main: $_ "; if ($_ =~ /baz/) { print "go! \n"; &aSub(*SESAME) } print "\n"; } sub aSub { my $inFile = shift; while (<$inFile>) { chomp; print "sub: $_"; if ($_ =~ /bao/ ) { print " return!"; return }; print "\n"; } }
foo bar baz bam bao fee fie
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing filehandle to sub
by marctwo (Acolyte) on Jun 09, 2003 at 13:23 UTC |