in reply to Calculating the crc checksum of a file using perl?

In an emergency, a band-aid like the following may suffice but be aware this has many problems: non-portable, no error checking, assumptions about checksum program and target file, and so on. As already stated, the work's been done so the easiest solution is to use what's offered on CPAN.

$ perl -E 'say +(split q{ } => qx{cksum compmesg.txt})[0];' 2782145713

-- Ken

Replies are listed 'Best First'.
Re^2: Calculating the crc checksum of a file using perl?
by AGhoulDoingPerl (Sexton) on Jul 09, 2011 at 04:10 UTC
    So we got no built-in functions nor a core module for crc-checksome?
    That hurts....
    (But then, how come SHA-1 and MD5 do have a core module for them?,
    they are a lot less popular than crc's for sure:()

      So we got no built-in functions nor a core module for crc-checksome? That hurts.... (But then, how come SHA-1 and MD5 do have a core module for them?, they are a lot less popular than crc's for sure:()

      If you really wish to know, you should ask the perl-5-porters, its their decision :)

      Others who want more stuff with their perl than comes with CORE make their own perl distribution, like Perl::Dist::Strawberry

      I'm curious, why do you think crc is popular? Sure, your harddrive/os/filesystem/browser... use it, but they use md5 and sha1 too

        <q>I'm curious, why do you think crc is popular? Sure, your harddrive/os/filesystem/browser... use it, but they use md5 and sha1 too</q>

        Ah.. it is just cultural. SHA-1 and MD5 are more accurate but they tend to be alot slower and also less known. You can kinda think that SHA-1 and MD5 as Python and Ruby, while crc32 being Perl. You see altought Python and Ruby are getting popularity, Perl is still as twice as popular compare to them.(accoding to an usage statistic by some websites)