Thanks for your Tips.

my $data = tell DATA;
print "$data\n";
truncate $0, $data;

This looks very promising to me.
Therefor that the host is a Unixsystem, I might be able to solve my problem.

I don´t really understand $0 at the moment.
I thought its the name the script was started with.

Bastian


-----Ursprüngliche Nachricht-----
Von: John W. Krahn [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 6. Juli 2004 06:37
An: Perl Beginners
Betreff: Re: __DATA__ Token Problem


On Monday 05 July 2004 05:07, Bastian Angerstein wrote:
>
> Hello,

Hello,

> I have a few questions regarding to the DATA Filehandle:
>
> 1.
> This handle ist opend by default or do I have to open it by myself?

It is opened by default.


> 2.
> Is it possible to change to content of what the handle so that the
> __DATA__ Sektion of my skript changes?

It depends on the operating system.  *nix will allow you to modify any
file if you have permission to do so.  Some versions of DOS\Windows
will allow you to modify running programs but most won't.


> 3.
> Can I delete anything data from DATA so that the __DATA__ section is
> empty?

Again, it depends on what the operating system will allow.

This works on my Linux OS:

#!/usr/bin/perl
use warnings;
use strict;

my $data = tell DATA;
print "$data\n";
truncate $0, $data;

__DATA__
line 1
line 2
line 3
line 4



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to