Hello archieg, and welcome to the Monastery!

Whatever sub check_dup_rec does, what is the point of calling it twice with the same arguments? If the first call returns a true value, the user is given the choice of either aborting the script or continuing. But neither of the two subroutine arguments is changed, so why call the same subroutine again immediately afterwards?

The second argument also looks suspicious to me: "$actv_id,$iteration_id,$wave_id". This creates a single string from the contents of 3 variables, separated by commas. I suppose that may be what you want, but it would seem more natural to pass those variables in as 3 separate arguments:

if (check_dup_rec("$APPHOME/DATA/lookup/lookup_file.txt", $actv_id, $i +teration_id, $wave_id))

Also: do you use the contents of $key after the if block ends? If not, why chomp it? For that matter, why assign it at all?

if (...) { print "\nTo ABORT press CTRL+C or Press ENTER key to Continue..."; <STDIN>; }

P.S. Your script is running under use strict; use warnings;, isn’t it? ;-)

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: lookup/duplicate check in perl by Athanasius
in thread lookup/duplicate check in perl by archieg

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.