in reply to Re: data from one subroutine into a second
in thread data from one subroutine into a second
You'll be in for a nasty surprise if you try and do that :) Try this snippet:
use strict; seek DATA, 0, 0; print while <DATA>; __DATA__ This is a test
From playing with that, you'll see that the seek returns to the beginning of the file, not the beginning of DATA. To correct that, you'll want to tell where DATA starts:
use strict; my $start = tell DATA; seek DATA, $start, 0; print while <DATA>; __DATA__ This is a test
Update: Reading jmcnamara's response. Boy, do I feel stupid. However, I'm now tempted to launch into my don't name a filehandle DATA rant, since this is a source of confusion (as demonstrated above). I recall ranting about this before. Humph. Maybe I'm just embarrassed :)
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re(2): data from one subroutine into a second
by jmcnamara (Monsignor) on Feb 27, 2002 at 15:52 UTC |