Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Storing changing data within a script after the __DATA__ token

by jynx (Priest)
on May 09, 2002 at 19:47 UTC ( #165478=note: print w/ replies, xml ) Need Help??


in reply to Storing changing data within a script after the __DATA__ token


shamless plug: a different way to do it

That's probably not the way you want to do it at all, but it works, if nothing else. What i did was: read the file into an array, pop off the lines from the end until i found the __END__ token, write over the original file (look at the c subroutine in the spoiler for the code). Since i had already read the data after the __END__ token before i wasn't missing anything, but one could also store the data while popping it off the array.

There are numerous ways to do it, and this is provided as a mere example of that. But really, i would suggest going with TheDamien's (and TheBrian's) module over this method for many reasons (most notably of which is maintainability).

jynx


Comment on Re: Storing changing data within a script after the __DATA__ token
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://165478]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2014-12-27 15:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls