Bhups
November 2, 2006, 2:55am
1
hi,
i am very much new in perl and have this very basic question in the same:(
the requirement is as below:
i have an input file (txt file) in which i have fields invoice number and customer number. Now i have to take input this combination of invoice n customer number and check in a lookup file (pipe delimited txt file) and if the combination exists, then i have to get the new invoice number (present in lookup table) and append this new invoice number into the original record of the input file.
for example:
input file record: aaabbbinvoicenum1customernum1333
lookup record:11111invoicenum1customernum18888newinvoicenum1
so now original input record becomes:
aaabbbinvoicenum1customernum1333newinvoicenum1
i have to use hash array here in perl with keys as invoice and customer number combination, but me not sure how to use it:(..
please help me out in solving this...
regards,
Bhups
For a Perl hash %hash, to set value $v with key $k, you can do so by
$hash{$k} = $v;
You can use exists($hash{$k2}) to test if %hash contains the key $k2. If exists, $hash{$k2} will return the value previously set; undef otherwise.
Bhups
November 6, 2006, 9:35am
3
bhups:
hi,
i am very much new in perl and have this very basic question in the same:(
the requirement is as below:
i have an input file (txt file) in which i have fields invoice number and customer number. Now i have to take input this combination of invoice n customer number and check in a lookup file (pipe delimited txt file) and if the combination exists, then i have to get the new invoice number (present in lookup table) and append this new invoice number into the original record of the input file.
for example:
input file record: aaabbbinvoicenum1customernum1333
lookup record:11111invoicenum1customernum18888newinvoicenum1
so now original input record becomes:
aaabbbinvoicenum1customernum1333newinvoicenum1
i have to use hash array here in perl with keys as invoice and customer number combination, but me not sure how to use it:(..
please help me out in solving this...
regards,
Bhups
hi moderators...can any body elaborate on the reply/solution???