#!/usr/local/bin/perl use strict; use warnings; my %seen = (); my $string = "an apple a day"; while ($string =~ /(.)/g){ $seen{$1}++; } print "unique charts are:", sort(keys %seen), "\n"; my $sum = 0; foreach my $ascval(unpack("C*", $string)){ $sum += $ascval; } print "sum is $sum\n"; my $checksum = 0; while(<>){ $checksum += unpack("%16C*", $_ ) } $checksum %= (2 ** 16) -1; print "$checksum\n";