Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by EricSilver

  1. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    The "on the fly" solution I described has been done, and works as required, so yes, the thread can end.
  2. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    Thanks Franco, In some cases (with fields other than the state abbreviations we have been discussing here) an exact length will be required, i.e., where NYC and NYCVB are unique values and a precise match is required. NYCCVB could, for instance, match NYC, however, NYCVB, as a unique value...
  3. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    To answer part of my own question, substr length can be a variable, so doing an the on-the-fly length change, just before the lookup, is where I will focus my energies, and hopefully get the result I need.
  4. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    My apologies for the confusion; I am asking two separate, but similar questions in the same thread, and not taking into account that some of the "wildcard" functionality I want will occur by default. Thank you Kevin for your good help to this point. Franco, your understanding of the state...
  5. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    Some further clarification: Say I have a lookup field that contains: "The Box is Blue" ($abbrev) I would want to match it exactly, but I know some comparison data ($data[8]) will contain: "The Box is Blue and Large" Therefore, I would want $abbrev to be "$abbrev.*" (The Box is Blue.*) so if...
  6. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    What I mean is, what if the field length is variable, i.e. the full state name field, where each text string would be a different length,and the ($abbrev,0,2) would not apply? Is there a wildcard that could be used in such situations? Here is my previous question from April 9th:
  7. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    OK, what am I missing here? The abbreviated states lookup are all uppercase, 2-characters, except Arizona, which, for testing purposes I have formatted like this: AZABBCCDDDGGGEE The below code works fine for all states, except Arizona which is generating an error...
  8. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    Is there a means of editing/deleting posts? In my previous post, I have this backwards: $ab = “$abbrev”; $ab =~ s/$ab/$ab#WILDCARD CHAR#/; Since $abbrev is the reference value, what I have there is wrong. The submitted value ( $data[8] ) is what needs to be wildcarded.
  9. EricSilver

    Need Urgent Help with Perl Lookup & Substitution Routine

    I plan to get back to it later today, using something like this (looks OK here, but won't know for sure until I try it): open(MAP,"<$maplocation")||die "Could not open $maplocation"; while (<MAP>) { chomp; ($code, $abbrev, $fullname)=split /::/, $_; $ab = “$abbrev”; $ab...
  10. EricSilver

    Need Urgent Help with Perl Lookup &amp; Substitution Routine

    By "something else" what do you mean? More than one or two extra characters? For ewxample, would the code you just submitted apply if the $abbrev field was: "The quick brown fox" and the comparison field was: "The quick brown fox chases cars"?
  11. EricSilver

    Need Urgent Help with Perl Lookup &amp; Substitution Routine

    Exactly what I am thinking, between lines 5 and 6 below. open(MAP,"<$maplocation")||die "Could not open $maplocation"; while (<MAP>) { chomp; ($code, $abbrev, $fullname)=split /::/, $_; $states{$abbrev}=$fullname; } close MAP;
  12. EricSilver

    Need Urgent Help with Perl Lookup &amp; Substitution Routine

    Actually, let me clarify that. If a state abbreviation field had one or more extra characters, i.e. "AZ" was written as AZX in the lookup file, and I wanted make sure it was interpreted as "AZ" using a wildcard, could that work? I dont see how "^AZ" could be incorporated into this code...
  13. EricSilver

    Need Urgent Help with Perl Lookup &amp; Substitution Routine

    Out of curiosity, would this also work with wildcards? For example, if I wanted all state abbreviations that began with "A" -- AZ, AL, AK, AR, -- all return "Arizona" as the $data[d8] value. Would this code accommodate the use of "." or "^" and other wildcard characters? $data[8] =...
  14. EricSilver

    Need Urgent Help with Perl Lookup &amp; Substitution Routine

    Works perfectly now! Thanks so much for all the good feedback. I Will eventually need to apply this lookup logic to additional files, but I do not anticipate too many problems. :-)
  15. EricSilver

    Need Urgent Help with Perl Lookup &amp; Substitution Routine

    Appears the 'while' loop is matching the state abbreviation, but not associating it with the full state name, which suggests I need another array and/or 'for' loop within the while, which seems more convoluted than my original code. But if it works, I'll use it. Any thoughts?

Part and Inventory Search

Back
Top