A Perl ASCII string is pretty much like a string in 'C'. This is a sequence of bytes in memory terminated by a x00 byte. Each character is encoded as one byte. In Perl you will never come across this last "null" byte.For fancy multi-byte character sets, I defer to wiser Monks than me.
In a 'C' or a Perl string, you will come across things like \n and \r. That backslash means, "hey this is NOT an "n" or an "r", this is something special and means 0x0A (new line) or 0x0D (carriage return) respectively.
In a Perl string, if you want something that otherwise would have a meaning, like the double quote character " to be taken literally (not part of Perl's translations), you put a \ in front of it.
In other words, this backslash thing means that the character which follows should be interpreted with a special meaning, if there is any such meaning. In the above, the backslash before the double quote (") means, hey this is not the end of the print statement quote, but rather please print literally a double quote. The \n means: this is not an "n", but rather a 0x0A character.print " this is a double quote, a \" \n";
I guess this as clear as mud, but I tried.
Updated with some strike-thru's.
In reply to Re: Perl5 Internal Representation of string variable
by Marshall
in thread Perl5 Internal Representation of string variable
by flexvault
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |