Hello guys and I am very appreciative to anyone whom might can give some direction on how to handle a current situation that I am dealing with. Please allow me to explain the best way that I can. I have a script that automatically assigns a number by excuting this code:

my $range = 200; my $minimum = 1000000000; my $jobNum = int(rand($range)) + $minimum;

When the value is assigned to $jobNum then I need to go an extra step in determining that the number has never been previously used. Of course, with a range that I have chosen, most likely it won't occur, but you can't assume either. The previously used $jobNum(s) reside in a file called aj.db which is a basic text file that the data is held in from html forms, with  | separators. I want to be able to search this file by opening it temporary (within the running script), search for the randomly assigned String, that is assigned at that moment, against the previously assigned Strings within the aj.db database file. <If> the String cannot be found then allow the current randomly assigned String to be used. Of course, if the String of numbers have been used before, then loop back to get a new random number and check again until one is found that has not been used. I'm sure there is a simple solution for this but I have not found none yet and cannot understand fully how this can be done. I have no current code to present in my testing to see if I can do this on my own. If anything, point me toward some ideas that i can try so I might achieve this own my own. Again, any help would be appreciated.

Thank you


In reply to Testing numeric strings by jlwoodruff

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.