Hi fellow monks.. ;).

Sorry to disturb you from your daily routines (hacking? ;J), but I can't seem to figure this out. What evil do special characters inflict on Perl arrays? Basically, I have pushed a piece of text containing special (control) characters '\cJ ...' and when I check on last array index via '$#' i get 10 whereas it should be 1 (since I know i added just that one string).

Here's a 'screenshot' from command line perl debugger:
CFML::Parser::TAG::Container::owner_of(/export/home/vlad/scratch/LIB/C +FML/Parser.pm:792): 792: $self->{op_stack}[++$#self->{op_stack}] = $t +hing; DB<1> x $self->{op_stack} 0 ARRAY(0x3f513c) 0 "\cJ\cI " DB<2> x $#self->{op_stack} 0 10 DB<3>
Why does it show 10 there when i do $#self->{op_stack}.? Should it not display '0' since that's the last index of the array as seen in earlier dump of that array via 'x' command?

Thank you. </code>

"There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith

In reply to Special characters in array by vladb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.