#!/usr/bin/perl use strict; use warnings; open( INPUT, ") { chomp; my ($word1, $word2) = split /:/, $_; $hash{$word1} = $word2; } close INPUT; # Carico la parte di file di testo che va analizzata open( CONTEGGIO, ">Wiki_Pulito/Prova/Conteggio.txt") or die "Can't open Conteggio.txt"; # Apro il file di output my $conto=0; my %arrayris; while (my $text = ){ for my $key (keys %hash){ my $value = $hash{$key}; if ($text =~/$key\/$key\/.*con\/con\/E.*$value\/$value\/S/is){ $conto++; } my $arrkey=$key."-".$value; $arrayris{$arrkey}=$conto; } } while ( my ($k,$v) = each %arrayris ) { print CONTEGGIO "($k) => $v\n"; } close LISTAPAROLE; close CONTEGGIO;