Tassilo Von Parseval wrote:
> On Sun, Jun 01, 2003 at 01:13:31PM +0200 Kevin Pfeiffer wrote:
> >
> > I almost asked about this earlier - if a script can also write to
> > itself. I wrote something to test it, but haven't had time to
> > look up the seek functions, etc. I suppose this only makes sense
> > in very limited situations (if at all)?
>
> I don't think you can use it for writing. DATA is meant for
> reading. But it's useful for embedded data:
>
>     while (<DATA>) {
>         ...
>     }
>     __DATA__
>     some data
>     to be used
>     by script
>
> Some CPAN modules use this technique to embedded some data.

You can't write to DATA but you can read your program if that's
any use. Like this

  seek DATA, 0, 0;
  while (<DATA>) {
      print;
  }
  __DATA__
  some data
  to be used
  by script

OUTPUT

  seek DATA, 0, 0;
  while (<DATA>) {
      print;
  }
  __DATA__
  some data
  to be used
  by script

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to