Heya monks. I'm writing a script to rcp a file from one machine to another and then check the sums after the rcp.
I cant use any modules but the default ones as it takes an act of god/congress/both to get a module installed here. The problem is comparing the files. Here's how i'm doing it now:
#this is hp-ux btw...
my $local_compare="/usr/bin/chksum $file";
my $remote_compare="rexec $host -l $user \"/usr/bin/chksum $file\"";
my $g=`$local_compare`;
my $h=`$remote_compare`;
# output of cksum on hockey-pux looks like
# [num] [num] [filename]
my @gg = split( ' ', $g );
my @hh = split( ' ', $h );
if ( $gg[ 0 ] != @hh[ 0 ] ) {
die( "files do not match.\n" );
}
I'm sure that there is a better way to do this. Any suggestions?
Also as a side note, I have found myself lately using ? : profusely. I haven't seen this too much in other peoples code lately but mine is littered with them. An example:
my $a = some_func();
$a ? do_something() : do_somethingelse();
This isn't like goto in C is it? I like it because it is compact and looks pretty cool compared to if()/else. Just want to make sure that it's not one of those "That's a really bad idea" things.
Thanks in advance for any and all criticism/tips/crap/etc.