I know there is a way to save the user's input in the perl file. For reasons not specified, no modules. I searched about saving to the __DATA__ portion, and this is what I scraped together.
if ($save == 1) {
my $where = tell(DATA);
open (CONF => '+<', $0);
seek CONF => 0, 2;
print CONF "Var1::$var1\nVar2::$var2\nVar3::$var3";
}
That simply appends the variables to the end of the file (as I expected it to). I tried seek CONF => $where, 1; but that yielded the same result.
So, after that length introduction, how can I save the user's input to the __DATA__ portion of my file?
Oh, and on a side note, If I compile (is that the correct verb for this situation) this into an executable, will the saving to __DATA__ still function correctly?
Also, please note that I do not tell at the end of the file. I am not sure if that has anything to do with it.
<(^.^-<) <(-^.^<) <(-^.^-)> (>^.^-)> (>-^.^)>
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.