Program that encodes a message into its own text Write a program that encodes given text into its own text, provided as input, without disrupting its logic. The program must also work as a decoder, restoring the original message from its text. It must retain its encoding/decoding functions after transformation.

More formally speaking, the required program P must perform the following transformations with the given message text M:
P(M,P)->P*
P*(P*)->M

Here P* is the transformed program, which also must satisfy the above rules, that is:
P*(M2,P*)->P**
P**(P**)->M2
and so on... Each subsequent encoding doesn't erase previously encoded text, so P** carries two messages - M and M2.

The easiest way for the program to distinguish between encoding/decoding modes is by the presence of the extra argument M, but the final decision is up to you, provided it is clearly stated. The program may read it's own text from the file. If the chosen language doesn't have means for this, the source text can be passed to the program in any other way.

There are trivial solutions, of course, so this is rather a popularity contest. Nevertheless, I impose restriction forbidding comments in the program text.
Perl

This is a one-liner in Perl just because it's possible.

if($ARGV[0]){open(F,__FILE__);while(&lt;F&gt;){print;print"$ARGV[0]\n"if/^_/;}}else{print&lt;DATA&gt;;}
__DATA__


The messages are written after __DATA__, most recent first.