in reply to How can read form __DATA__ via filehandler
Now in the main scriptpackage foo; sub getdata { return *DATA } 1; __DATA__ this data is in foo
And the output isuse foo; my $d = foo->getdata; print "foo's data - ", <$d>; print "main's data - ", <DATA>; __DATA__ this data is in main
As you can see, if you just reference it (and the __DATA__ token exists) then perl does the right thing (of course :).foo's data - this data is in foo main's data - this data is in main
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How can read form __DATA__ via filehandler
by filipe (Novice) on May 21, 2003 at 15:37 UTC | |
by jeffa (Bishop) on May 22, 2003 at 05:41 UTC |