With warnings and use diagnostics I get this explanation:
Variable "$sep" is not available at (eval 9) line 1 (#1)
    (W closure) During compilation, an inner named subroutine or eval is
    attempting to capture an outer lexical that is not currently available.
    This can happen for one of two reasons. First, the outer lexical may be
    declared in an outer anonymous subroutine that has not yet been created.
    (Remember that named subs are created at compile time, while anonymous
    subs are created at run-time.) For example,
    
        sub { my $a; sub f { $a } }
    
    At the time that f is created, it can't capture the current value of $a,
    since the anonymous subroutine hasn't been created yet. Conversely,
    the following won't give a warning since the anonymous subroutine has by
    now been created and is live:
    
        sub { my $a; eval 'sub f { $a }' }->();
    
    The second situation is caused by an eval accessing a variable that has
    gone out of scope, for example,
    
        sub f {
        my $a;
        sub { eval '$a' }
        }
        f()->();
    
    Here, when the '$a' in the eval is being compiled, f() is not currently being
    executed, so its $a is not available for capture.
    
Use of uninitialized value $sep in concatenation (.) or string at (eval 9) line
        1 (#2)
    (W uninitialized) An undefined value was used as if it were already
... snip ...

In reply to Re: A 'print' at one spot changes a value at another by lidden
in thread A 'print' at one spot changes a value at another by ralphmerridew

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.