basm100 has asked for the wisdom of the Perl Monks concerning the following question:
I have a subroutine that writes into the filehandle DATA. I open this for reading and writing like this:
I then call up a subroutine that prints data into DATA. I then want a second subroutine to act on DATA which I call up in subroutine 2 like this:print "output file name: \n"; chomp($outfile=<STDIN>); open (DATA, "+>$outfile" ) || die;
I don't think the second subroutine is getting the data properly.sub countprog{ my $pos=0; my $printblock=0; while(<DATA>) { #do a load of various things looking line-by-line at my data print DATA2 "results of this 2nd subroutine"; }
Is there a better way to put data from one subroutine into another ? thanks,
basm100
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: data from one subroutine into a second
by jmcnamara (Monsignor) on Feb 27, 2002 at 15:28 UTC | |
by Ovid (Cardinal) on Feb 27, 2002 at 15:46 UTC | |
by jmcnamara (Monsignor) on Feb 27, 2002 at 15:52 UTC | |
|
Re (tilly) 1: data from one subroutine into a second
by tilly (Archbishop) on Feb 27, 2002 at 16:31 UTC | |
|
Re: data from one subroutine into a second
by jonjacobmoon (Pilgrim) on Feb 27, 2002 at 16:13 UTC | |
|
Re: data from one subroutine into a second
by dragonchild (Archbishop) on Feb 27, 2002 at 15:34 UTC | |
by jmcnamara (Monsignor) on Feb 27, 2002 at 15:40 UTC |