As hippo has pointed out, you haven't really shown us any code. I'm guessing, however, that you have declared and are using  $epname as a lexical variable within your "loop," and so the variable name vanishes when the loop is exited:

while (some_condition_is_true()) { ... my $epname = some_string(); ... print "for debug: \$epname is '$epname' \n"; ... } $newTitle = $epname; # variable does not exist here
If you want a lexical  $epname to exist and have the value it was given in the loop when it's outside the loop, do something like:
my $epname; while (some_condition_is_true()) { ... $epname = some_string(); # do NOT declare new variable ... } $newTitle = $epname; # variable exists, has value here


Give a man a fish:  <%-{-{-{-<


In reply to Re: Using a value to add to xml line by AnomalousMonk
in thread Using a value to add to xml line by Anonymous Monk

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.