Dear spiritual brothers and sisters,

having found something, that transcend my understanding, and in the search for truth, I would like to share it with you. Having exactly this line in my here document, all $context_desc variables are interpolated correctly, except of the last one, which is interpolated as $context - I have such variable too.

action=setwpos %u +1 ($desc) ; shift ($context_desc) @{[COUNTER_START_VAR]} ; shift ($context_desc) @{[COUNTER_STATE_VAR]} ; eval @{[COUNTER_STATE_VAR]} ( \$counter=@{[COUNTER_STATE_VAR]}; ++\$counter; ) ; add ($context_desc) @{[COUNTER_START_VAR]} ; add ($context_desc) @{[COUNTER_STATE_VAR]} ; assign @{[COUNTER_STATE_VAR]} 0 ; set ($context_desc) $restart

Tried also ${context_desc}, but with the same result. I was suspitious, if this line is not too long for here document (not knowing, if there are some limitations), but this is not the longest line in here document, and I haven't found other failed interpolations. Tried also complete replacement of all characters in variable name (if hidding some invisible special character), but repeatedly the same result.

Any tips?

Using perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi in WSL.


In reply to inconsistent variable interpolation in here document by richard.sharpe

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.