dear monks, i had been trying to make a file analyzer which reads keys from a file named labels seperates them using the delimiters @ each line and then checking for the keys from other file en_1000 and hi_1000 and printing them on another. i wrote this code , but its outputting nothing. i tried to check it by placing a print @ the 3rd line of the main program. but still no clue.

#!/bin/env perl use strict; use warnings; use Data::Dumper; sub split_english() { open(ENGLISH,">>en_index") or die $!; my @engli=<ENGLISH>; foreach my $keys(@engli) { chomp($keys); my @key_en = split(/\:/,$keys); print ENGLISH @key_en; } my $key_enco= join '|',my @key_en; my $file2='/home/vikash/pro_1/en_1000'; open my $fh1, $file2 or die $!; my %key_en; while (<$fh1>) { while (m{\b($key_enco)\b}g) { $key_en{$1}++; } } open(INFOO,">>result"); print INFOO Dumper(\%key_en); close INFOO; } sub split_hindi() { open(HINDI,">>hi_index") or die $!; my @hin=<HINDI>; foreach my $key(@hin) { chomp $key; my @key_hin = split(/\;/,$key); print HINDI @key_hin; } my $key_hico= join '|',my @key_hin; my $file='/home/vikash/pro_1/main_database_hindi'; open my $fh, $file or die $!; my %key_hin; while (<$fh>) { while (m{\b($key_hico)\b}g) { $key_hin{$1}++; } } open(INFOOO,">>result"); print INFOOO Dumper(\%key_hin); close INFOOO; print "*************************************************************** +***********\n******************************************************** +******************"; } open(HANDLE, ">>/home/vikash/pro_1/labels") or die $!; my @keys=<HANDLE>; close HANDLE; print @keys; foreach my $line(@keys) { chomp($line); (my $english_index, my $hindi_index ,my $nua)=split(/\|/,$line); open (HANDLE,">en_index") or die $!; print HANDLE $english_index; open(HANDLE_HI,">hi_index") or die $!; print HANDLE_HI $hindi_index; split_english(); split_hindi(); }

In reply to reading from and writing to a file by vikashiiitdm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.