in reply to lookup/duplicate check in perl
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, |
|
|---|