in reply to Counting Similar Strings
Which prints..#!/usr/bin/perl -w use strict; use Data::Dumper::Simple; my %strings; while (<DATA>) { chomp; $strings{$_}++; } print Dumper(%strings); __DATA__ string1 string2 string3 string1 string1 string7 string2
%strings = ( 'string3' => 1, 'string7' => 1, 'string1' => 3, 'string2' => 2 );
Have a look in the Q&A section under hashes for some more examples.
Hope this helps,
Darren :)
|
|---|