#!/usr/bin/perl use strict; use warnings; # 888817 my @array; my $file = "888817.txt"; open FH, '<', $file or die "Can't open $file: $!"; # while ( $file ) { my @line = ; for my $line(@line) { if ( $line =~ /^\n/ ) { next; } else { (my $found) = $line =~ m/<.[^>]*>/g; print "\$found: $found \n"; push @array, $found; } } for( my $i=0; $i<@array; $i++){ print "The Element $i is $array[$i]\n"; } for( my $j =0; $j<@array; $j++){ for( my $k=$j+1; $k<@array; $k++) { if( $array[$j] eq $array[$k]) { print "substring($array[$j],$array[$k])\n"; } } }