in reply to BoSelecta __DATA__ and rewind.

The DATA filehandle is simply a filehandle that is opened on the script being compiled, and which is left positioned at the line following the __DATA__ at the end of compilation. If you reset the handle to BOF, you'll just read the script again.

Before reading from DATA, use tell() to get the current file postion, then seek to there when you want to rewind the file handle.

Dave.

Replies are listed 'Best First'.
Re^2: BoSelecta __DATA__ and rewind.
by blackadder (Hermit) on Oct 04, 2004 at 13:29 UTC
    This what I changed to,...still did,'t work because I not familier with Seek(), Tell(),..etc.

    Can you please put me out of my misry

    Thanks
    else { my $dpos = tell(DATA); print "\n$dpos"; chomp ( @work_file=<DATA>); seek (DATA ,2,"SEEK_SET"); }
    Blackadder
      blackadder,
      Perhaps this will help:
      #!/usr/bin/perl use strict; use warnings; my $pos = tell DATA; print while <DATA>; seek DATA, $pos, 0; print uc while <DATA>; __DATA__ one two three four

      Cheers - L~R

        Hey "Limbic~Region", Thanks buddy.
        Blackadder