#!/usr/bin/perl use strict; use warnings; open( LABELS, "labels" ) or die "labels: $!\n"; my @english; my @hindi; while () { my ( $eng_indx, $hin_indx ) = map { s/:/|/; $_ } split( /\|/ ); push @english, $eng_indx; push @hindi, $hin_indx; } open( EN, "/home/vikash/pro_1/en_1000" ) or die "en_1000: $!\n"; my @enlines = ; open( HI, "/home/vikash/pro_1/HI_1000" ) or die "HI_1000: $!\n"; my @hilines = ; for my $i ( 0 .. $#english ) { print grep /$english[$i]/, @enlines; print grep /$hindi[$i]/, @hilines; print '*' x 50, "\n"; }