in reply to Re^2: Exact string matching
in thread Exact string matching
it prints how many time each word occured ..use Data::Dumper; open (HAN,'employee.pm'); my $cont = <HAN>; # assume $cont = 'package Employee df df'; my %hash = (); while ( $cont =~ m/(\w+)/g ) { $hash{$1}++; } print Dumper(\%hash); --------- output $VAR1 = { 'Employee' => 1, 'df' => 2, 'package' => 1 };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Exact string matching
by Anonymous Monk on Oct 16, 2011 at 12:40 UTC |