in reply to Extracting common words

#!/usr/bin/perl # http://perlmonks.org/?node_id=1145607 use File::Slurp; use strict; use warnings; my $f1 = shift; my $f2 = shift; my (%hash1, %hash2); $hash1{$_} = 1 for lc(read_file $f1) =~ /[A-Za-z0-9]+/g; $hash2{$_} = 1 for lc(read_file $f2) =~ /[A-Za-z0-9]+/g; my $count = my @common = sort grep $hash2{$_}, keys %hash1; print "count: $count\n@common\n";

Replies are listed 'Best First'.
Re^2: Extracting common words
by Anonymous Monk on Oct 22, 2015 at 16:22 UTC

    $script =~ s/A-Z//g;