Hi sellinios,

As talexb said, you really need to show some code for us to see where you're having problems.

That said, it's a fair bet the first error you've got:

rm: cannot remove ‘/home/meteo/Build_WRF/DATA/WRF/greece-9km/201604211 +2/wps/FILE:*’: No such file or directory

happened because the code was trying to remove all files a bunch of files that didn't exist. You're probably running on Linux because of the /home dir, and the "rm" command. On my Linux system, the same error (and the same exit status, 256) happen with this test script:

#!/usr/bin/perl -w use strict; use warnings; system("rm dir/FILE:*"); my $err = $?; print "Error is $err\n"; # Output is: rm: cannot remove ‘dir/FILE:*’: No such file or directory Error is 256

If I change that script to use glob and unlink (better because they're Perl builtin functions, hence don't rely on calling the shell which is a more expensive operation):

#!/usr/bin/perl -w use strict; use warnings; foreach my $file (glob("dir/FILE:*")) { if (!unlink($file)) { print "Warning: failed to remove file '$file' ($!)\n"; } }

That way, if there aren't any files, it won't fail due to shell not finding any matches.

It's interesting to note that the shell will always do its own globbing before passing results to the command (rm in your case) -- to verify this, you can try "echo *" and see all your files/dirs the way they'd look prior to passing them to any Unix command ("ls" for example).

And unlike Perl, the shell will throw an error if a wildcard such as "*" or "?" fails to find any matching files.

say  substr+lc crypt(qw $i3 SI$),4,5

In reply to Re: Perl script error by golux
in thread Perl script error by sellinios

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.