Four notes about your code, probably wrong and surely unrelated with your problem, but...

1 - You could use chdir and/or put "/home/vcg/Documents/Trial" in a $dirname var saving a lot of typing. This also will protect you of mistakes like this:

$cmd = "rm /home/vcg/Documents/Trial/ $MAF"; #this extra space could delete the whole file $MAF AND the whole parentdir (at least under some circumstances) when you pass this chain to "system" in the next line.

(Also, consider to unlink a file instead to rm a file, is more portable)

2 - You should survey all this changes in the value of the cmd var, I'm worried specially by things like this:

my $cmd = "/home/vcg/Documents/Trial/muscle -in $Fprot -out $MAF"; system ($cmd);

see the trouble here? you're missing a "." sign. If you want to run the local executable named muscle in the shell you should write "./muscle", not simply "muscle". Even if your local system knows that muscle IS an executable, the remote system could ignore all about this. This could also be ambiguous to the remote shell (that will search in vain the file in its own hard disk and return false instead to run the command) .

3 - if you "open my $filehandle..." you can treat $filehandle as any other scalar variable, you could probably use simply while ($filehandle) instead while (<$FILEHANDLE>) unless you have a reason to do this (that I'm probably missing)

4 - There is room still for improving your code. You could probably put "use autodie;" in your header, quit a lot of unnecessary "()" here and there, avoid the need for creating some vars, etc


In reply to Re: -s testing for empty file; works on local, but not on remote by pvaldes
in thread -s testing for empty file; works on local, but not on remote by Jeri

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.