In double-quoted strings, back-slashes are interpolated. The sequence \cX will be interpolated as a control-X. You can rewrite this in two forms:
$MakeMain = 'javac ' . $java_opt . ' ' . $class_dir . '\comm\client\Main.java'; $MakeMain = "javac $java_opt $class_dir\\comm\\client\\Main.java";
See perlop for information about single- and double-quoted strings.

Update: This can actually all be done a little cleaner:

@MakeMain = ('javac', $java_opt, $class_dir.'\comm\clients\Main.java'); system(@MakeMain);
This has the added benefit of keeping your code a little more secure against tampering, by using unsafe data in $java_opt or $class_dir (or potentially so, since I have no idea how you're getting this data). Plus using system() in this form is faster, since it doesn't have to spawn off a shell interpreter to parse your string. If $java_opt as a set of options separated by spaces, though, it won't work very well. You'd either need to split the string or just go with the full string version as you are doing in your original code.

In reply to Re: Use of slashes and backslashes? by Fastolfe
in thread Use of slashes and backslashes? by Splatt

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.