Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Perl5 Internal Representation of string variable

by ig (Vicar)
on Oct 02, 2010 at 17:42 UTC ( #863092=note: print w/replies, xml ) Need Help??

in reply to Perl5 Internal Representation of string variable

perlunitut Definitions gives definitions for text, character, unicode (three terms for the same thing) and binary and byte (two terms for the same thing) strings. It also says a little about internal format. The other documents referenced in the SEE ALSO section provide more detail.

While the basic data types in Perl are three: scalar, array and hash, this is only one level of abstraction. If you delve a little deeper, you find that there are five types of values that can be loaded into a scalar, one of which is a string. There are various data structures used to store these types of values. You can read about this and more in perlguts and B. Other good sources on the internal data structures are Perl 5 Internals - Internal Variables and PerlGuts Illustrated. Ultimately, you might spend some time studying the source code, which is freely available but not a trivial endeavor.

  • Comment on Re: Perl5 Internal Representation of string variable

Replies are listed 'Best First'.
Re^2: Perl5 Internal Representation of string variable
by flexvault (Monsignor) on Oct 02, 2010 at 18:35 UTC

    Thank you

    ig answer pointed to Perl 5 Internals - Internal Variables, which if I had previously known about, I probably would not have wasted anyone's time. Using Devel::Peek, I could see exactly how the internal representation of the string variable was defined. Great answer.

    Marshall's answer was correct initially, since all string type scalars end with a '\0' as well as allow them in the content.

    I compile all my own versions of perl, so I have often looked at the source, but I agree it is "not a trivial endeavor."

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863092]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2018-03-24 20:25 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.