http://qs1969.pair.com?node_id=30400


in reply to Comparing checksums of local/remote files.

At one level, your question is basically "I want to do something that's best done by existing software, only I can't install it" and the obvious answer is "well, fix whatever management or admin problem is preventing you from installing it".

I have no comments about the way you're checksumming or rexecing. That looks reasonable to me (although you don't check for errors in $?).

However, I can help you with Perl ...

I hate those uses of the hook. That's something that should be an if() in my books, even though it's more typing for you. Not to mention that the precedence of ?: will bugger you up:

$a % 2 ? $a += 10 : $a *= 2 ($a % 2 ? $a += 10 : $a) *= 2 # what it really is
Surprise. However, in all honesty, for things where precedence isn't an issue, it's a personal preference style matter. My tastes are to use ?: for picking between values, and if() for picking between bits of code.

Try this to remove the arrays:

my ($gg) = split ' ', $g; my ($hh) = split ' ', $h;
This makes use of the list context caused by the parentheses around $gg and $hh (without the parentheses you'd end up storing the number of fields in $gg rather than the first field), as well as the fact that split does no more work than it has to. If you're assigning to one item, it'll only split up to the first item.

Hope this helps,

Nat