perl Comments 1 min read

#/usr/bin/perl
use strict;
use warnings;
my $str = $ARGV[0];
my @alpha_arr = ('a' .. 'z');
my %str_tok_hash = map { lc($_) => undef }
grep { /[a-z]/i }
split(//, $str);
my @diff = grep { not exists $str_tok_hash{$_} } @alpha_arr;
$str = "'The string ($str) contains all the letters of the alphabet";
$str .= " except (".join(' ', sort @diff).").' - contains all the letters";
$str .= " of the alphabet..";
print "$str\n";

Share this post

Comments