For the first task, you can just has the values.
use File::Slurp;
foreach my $line ( read_file($filename) ) {
$hash{$line}++;
}
while ( my ( $key, $value ) = each %hash ) {
if ( $value > 1 ) { print $value }
}
As for the other, that's pretty complex unless you have specific patterns...
On Wed, Mar 18, 2009 at 1:10 PM, Yossi Itzkovich
<[email protected]> wrote:
>
> Hi,
> I am looking for a module that will get a file with text lines, and will find
> repeating patterns.
> Example: given the following file:
> -----
> I want to go home
> 1+3=4
> Hello World
> 1+3=4
> Hello World
> 8+2=10
> Hello World
> Klskd
> -----
> The script should tell me that the sequence : 1+3=4 and Hello World repeat 2
> times. A better script may tell me even that the more general pattern:
> {number}+number}={number} and Hello World repeat 3 times.
>
> Any suggestion?
>
> Thanks
> Yossi
> _______________________________________________
> Perl mailing list
> [email protected]
> http://perl.org.il/mailman/listinfo/perl
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl