|Don't ask to ask, just ask|
Re: -s testing for empty file; works on local, but not on remoteby pvaldes (Chaplain)
|on Sep 26, 2011 at 23:13 UTC||Need Help??|
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:
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