Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??

First, you shouldn't be using system for that operation, you should be using Perl's builtin rename, or move from the core module File::Copy.

Second, if you ever do need to run an external command, see my node Calling External Commands More Safely.

Update: Additionally, when you run your Perl script from the command line, you need to properly escape/quote the filename (e.g. in single quotes) to prevent special characters in the filename (like the brackets) from being interpreted by the shell. Modern shells' tab completion can do this for you.


In reply to Re: Why does system("mv $x $y") not work when it works at the command line? (updated) by haukex
in thread Why does system("mv $x $y") not work when it works at the command line? by Cody Fendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.