I think it's almost always better to use the perl builtin or a module than a system call. First, it makes your code more portable. What if the script needs to be run on an OS without a "mv" command? Second, it's probably a bit easier to do error handling when calling a perlfunc than having to trap (and sometimes fiddle with) the return value of system. Given the plethora of great modules such as Archive::Tar, File::Copy, Compress::Zlib, Archive::Zip, etc. I find that I very rarely need to do a system call. There are times when you need to call an OS specific or some other 3rd party program but I find those times to be very rare. Whenever I find myself using system I always ask myself "Self, is there an all-perl way to do this?" It's saved me time more than once when I had to port the script to a different OS.
-
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.
|