#!/usr/bin/perl -w my %hashtable; my $fn = <>; ##### File 1 is the input. open(FH, "$fn") || die "Cannot open file";

First, do a favour to yourself and use strict as well. Then, if you don't chomp $fn, it will end with "\n" and be unlikely albeit not impossible to be the real filename you're after. Last, $fn is called "useless use of quoting." Well, it's not really "last" because I may point out that you'd better use lexical filehandles, the three args form of open, low precedence short circuiting logical operators, include both the name of the file and more importantly the cause of the error ($!) in the error message, etc. But I'll try to stick to pointing out only the major issues...

my $one_number = $numbers[$hashtable{$name} - 1]; ### Error warnin +g in this line if ( $one_number >= 20 ) { print "$name $hashtable{$name} $one_number\n"; ### Error warn +ing in this line

Indeed: what if $name is not a key of $hashtable? Appearently you have one or more names in the second file that are missing from the former. Try finding out which ones they are. A simple

say "<$name>" unless exists $hashtable{$name};

would do: the additional < and > marks are there to be sure about "hidden" characters like spaces. But if you want to be really fussy you may even try:

say map {my $_=$_; s/([^[:print:]])/sprintf '\\%03o', $1/ge; "<$_>"} $ +name unless exists $hashtable{$name};
--
If you can't understand the incipit, then please check the IPB Campaign.

In reply to Re: Help to identify Error in my program by blazar
in thread Help to identify Error in my program by ashnator

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.