comparing hash element to table element perl
<p>I have a program that compares each line of two files, each line contains one word, if simply read the two files and stock the data into table, and compare the element of the two tables,
the first file contain:
straight </p>

<pre><code>work 

week 

belief time 

saturday 

wagon

australia

sunday 

french 
...
</code></pre>

<p>and the second file contain</p>

<pre><code>firepower         

malaise         

bryson         

wagon         

dalglish 

french
...
</code></pre>

<p>this will take a long time to compare file, so I propose another solution, but this doesn't work</p>

<pre><code>#!/usr/bin/perl
use strict;
use warnings;

open( FIC,  $ARGV[0] );
open( FICC, $ARGV[1] );

print "choose the name of the file\n";

chomp( my $fic2 = &lt;STDIN&gt; );
open( FIC2, "&gt;$fic2" );
my $i=0;
my $j=0;
my @b=();
my %stops;
while (&lt;FIC&gt;)    #read each line into $_
{
    # Remove newline from $_
    chomp;
    $_ =~ s/\s+$//;
    $stops{$_} = $i;    # add the line to
    $i++;
}

close FIC;

while (&lt;FICC&gt;) {
    my $ligne = $_;
    $ligne =~ s/\s+$//;
    $b[$i] = lc($ligne);

    # $b contain the data

    $i++;
}

foreach my $che (@b) {

    chomp($che);

    print FIC2 $che;
    print FIC2 " ";

    print FIC2 $stops{"$che"}; print FIC2 "\n";

    #this returns nothing

}
</code></pre>

<p>The problem is in<code>this command  $stop{"$che"};</code> in the case that the elment don't exist in the hash %stop, it return an integer and an error</p>

<p>Use of initalized value in print c:/ats2/hash.pl line 44,  line 185B2</p>