I am trying to push a load of information onto an array, some of which looks like this:

push(@text,"CACHEFILE C:\\wwwtools\\analog\\OldLogs\\Cache\\All\\@ParsedTime[$year]$Months{@ParsedTime[$month]}-2* \n");

push(@text,"CACHEFILE C:\\wwwtools\\analog\\OldLogs\\Cache\\All\\@ParsedTime[$year]$Months{@ParsedTime[$month]-1}* \n");

What im trying to do is print out something that looks like YYMM. Its a bit messy,but $Months is a hash to convert the day (in words) to the day in numbers. So what i want to do is actually take @ParsedTime[$Month] - C, c being a constant number, and sent that to the Months array.

So if im on month 10 it will use month 8 and month 9 and push them onto the array. My problem is that the program is outputting it as a literal statement, something like 12-1 where 12(the current month) was passed correctly to $Months and converted, but the -1 is added onto the string. I tried passing the value like this also:

push(@text,"CACHEFILE C:\\wwwtools\\analog\\OldLogs\\Cache\\All\\@ParsedTime[$year]$Months{@ParsedTime[$month-1]}* \n");
But that actually wont output anything at all. I am all out of ideas, does anyone have any they wish to share with me?

In reply to Using expressions in string literals by wizard341

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.