is quite good as checksum algorithms go (it uses a 32 bit CRC AFAIK which is good). md5sum
is better but you may not have it installed on the machine - if you do then use that for even more feelgood factor.
As for your code - you should check the size of the file too as well as the CRC. The CRC has roughly a 1 chance in 2^32 of failing to detect an error. If you constrain that further by checking the length of the file then you'll add several orders of magnitude to that number (depending on the lengths of your files of course).
# Same to here then
my @gg = split /\s+/, $g;
my @hh = split /\s+/, $h;
die "Files do not match"
if $gg != $hh || $gg != $hh;
If you could install a module on the far end then I'd install Digest::MD5
and use that. If you can't install any stuff then what you've got looks pretty good to me.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.