Shlomi Fish <shlo...@shlomifish.org> writes:

>> I've been googling for examples of how to create a sha-2 sum of a file
>> in perl without success.  What I'm looking for is something like:
>
> In general, you should not Google for Perl information, because Google tends 
> to
> find outdated results. Instead, use MetaCPAN - http://metacpan.org/ with a
> fallback to DuckDuckGo - https://duckduckgo.com/ .

Oh, ok.

> You can write create_sha2_sum like that (untested):
>
> <CODE>
> sub create_sha2_sum
> {
>       my ($filename) = @_;
>       
>       my $sha = Digest::SHA->new(512);
>       $sha->addfile($filename);
>       
>       return $sha->hexdigest();
> }
> </CODE>

Cool, thank you, that looks very much like what I ended up with for my
test script :)


-- 
"Object-oriented programming languages aren't completely convinced that
you should be allowed to do anything with functions."
http://www.joelonsoftware.com/items/2006/08/01.html

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to