Hello..again.. Well, I'm stuck and used all resources and now I'm here again for help. --objective of subroutine: to take the aba, acct, and time from a file and compare to another file. if it's not there, then print to comparing file. Comparing to this file. File looks like this:
0246801357;12345678;000425 # aba, acct, time
I am just reading the above file, if all matches, then print out to an error file that the info is already there. if doesn't match, print unmatched to the above file and set the variabe $trans_code to 'true'. when opening Tracking at beginning of program, it is opened with >> for appending. All variables are global.
sub table{ seek(TRACKING, 0, 0); while (defined($t_table = <TRACKING>)){ chomp($t_table); @trk = split(/;/, $t_table); if (($trk[0] == $aba) && ($trk[1] == $acct) && ($trk[2 +] == $time)) { print ERROR "ABA:$aba\tAccount:$acct\t$time already in +table\n"; } else { print TRACKING "$aba;$acct;$aba\n"; $trans_code = "true"; } # end else / if } # end while tracking } # end sub table
This subroutine is called in the script by &table; Is there something missing? I've tried calling with &table();, I've put the last variable initialized in a return statement -- return($trans_code_valid).. how to make it work, help please.. thanks in advance... i'm learning (atleast i used code tags in this posting!) Zo

In reply to nonworking subroutine by Zo

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.