When I'm using the perl debugger and I want to make sure I can see exactly what is contained within a string, I do something like this:
p "==$string_variable=="
Any sort of whitespace at the edges of the string value (or anywhere within it) will be obvious that way, as well as any quotes or other stuff. The occurrence of an empty string comes across pretty clearly as well.

For that matter, you could improve your error message from the "die" call, to make it more likely for the real problem to be visible:

chdir($cmd) or die "chdir($cmd) failed: $!";
If you know that the parens should contain only a valid path string and nothing else, then putting the string into error message will make it possible to see whether the variable really contains what you intended (without having to use the perl debugger).

In reply to Re: Updates problem with single quote by graff
in thread Updates problem with single quote by Sun751

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.