Lawliet has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Saving to __DATA__
by GrandFather (Saint) on Jul 14, 2008 at 04:41 UTC | |
by Lawliet (Curate) on Jul 14, 2008 at 06:14 UTC | |
by GrandFather (Saint) on Jul 14, 2008 at 11:26 UTC | |
by Anonymous Monk on Jul 14, 2008 at 04:47 UTC | |
by ikegami (Patriarch) on Jul 14, 2008 at 05:48 UTC | |
by GrandFather (Saint) on Jul 14, 2008 at 04:56 UTC | |
|
Re: Saving to __DATA__
by ysth (Canon) on Jul 14, 2008 at 05:47 UTC | |
|
Re: Saving to __DATA__
by zentara (Cardinal) on Jul 14, 2008 at 12:48 UTC | |
|
Re: Saving to __DATA__
by apl (Monsignor) on Jul 14, 2008 at 11:49 UTC | |
|
Re: Saving to __DATA__
by massa (Hermit) on Jul 14, 2008 at 12:35 UTC | |
|
Re: Saving to __DATA__
by Lawliet (Curate) on Jul 14, 2008 at 12:44 UTC | |
by Tanktalus (Canon) on Jul 14, 2008 at 15:56 UTC |