Skip to content

Commit

Permalink
Merge pull request #21 from rwp0/patch-1
Browse files Browse the repository at this point in the history
[doc] Update Digest::MD5 Synopsis and Examples
  • Loading branch information
toddr committed Dec 30, 2023
2 parents 361e384 + b9d2694 commit 48e70d8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions MD5.pm
Expand Up @@ -54,14 +54,14 @@ Digest::MD5 - Perl interface to the MD5 Algorithm
# Functional style
use Digest::MD5 qw(md5 md5_hex md5_base64);
$digest = md5($data);
$digest = md5_hex($data);
$digest = md5_base64($data);
my $digest = md5($data);
my $digest = md5_hex($data);
my $digest = md5_base64($data);
# OO style
use Digest::MD5;
$ctx = Digest::MD5->new;
my $ctx = Digest::MD5->new;
$ctx->add($data);
$ctx->addfile($file_handle);
Expand Down Expand Up @@ -259,10 +259,10 @@ The same checksum can also be calculated in OO style:
use Digest::MD5;
$md5 = Digest::MD5->new;
my $md5 = Digest::MD5->new;
$md5->add('foo', 'bar');
$md5->add('baz');
$digest = $md5->hexdigest;
my $digest = $md5->hexdigest;
print "Digest is $digest\n";
Expand All @@ -278,7 +278,7 @@ This is useful when calculating checksum for files:
open (my $fh, '<', $filename) or die "Can't open '$filename': $!";
binmode($fh);
$md5 = Digest::MD5->new;
my $md5 = Digest::MD5->new;
while (<$fh>) {
$md5->add($_);
}
Expand Down

0 comments on commit 48e70d8

Please sign in to comment.