hydo has asked for the wisdom of the Perl Monks concerning the following question:
#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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comparing checksums of local/remote files.
by fundflow (Chaplain) on Aug 30, 2000 at 22:51 UTC | |
by hydo (Monk) on Aug 30, 2000 at 23:01 UTC | |
by fundflow (Chaplain) on Aug 31, 2000 at 00:49 UTC | |
|
Re: Comparing checksums of local/remote files.
by gnat (Beadle) on Aug 31, 2000 at 00:48 UTC | |
|
(jeffa) Re: Comparing checksums of local/remote files.
by jeffa (Bishop) on Aug 30, 2000 at 22:41 UTC | |
|
Re: Comparing checksums of local/remote files.
by ncw (Friar) on Aug 31, 2000 at 01:00 UTC | |
by Nooks (Monk) on Aug 31, 2000 at 03:41 UTC | |
|
Re: Comparing checksums of local/remote files.
by hydo (Monk) on Aug 31, 2000 at 01:43 UTC |