in reply to -s testing for empty file; works on local, but not on remote
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: -s testing for empty file; works on local, but not on remote
by jwkrahn (Abbot) on Sep 26, 2011 at 23:33 UTC | |
by pvaldes (Chaplain) on Sep 27, 2011 at 08:10 UTC | |
Re^2: -s testing for empty file; works on local, but not on remote
by Jeri (Scribe) on Sep 27, 2011 at 12:58 UTC |