in reply to reading __DATA__ more than once

$offset = tell DATA and seek DATA, $offset, SEET_SET. It's just a filehandle - reset it's position when you need to.

__SIG__ use B; printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;

Replies are listed 'Best First'.
Re: Re: reading __DATA__ more than once
by strat (Canon) on Nov 14, 2002 at 08:57 UTC
    If you jump back to the beginning, just take care not to jump too far, because otherwise you will get the sourcecode of the script as "DATA", e.g. the following script prints its own sourcecode...
    #! /usr/bin/perl seek (DATA,0,0); print <DATA>; __DATA__ warn "Just another perl hacker\n";

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"