Dear more experienced Perl Monks,

Sorry about the confusion: I've added the code I'm using so you can better see what I'm trying to do. I've been working on a script that searches a data sheet for certain values and prints values from rows that match a certain description.
Here's an example of a sheet I'm searching:
Score | Points | Time | Points | Record | Size | Points | Age | Points + | Difficulty | Size | Points | Name 4 |15 |356 |17 |45 |14 |45 |24 |12 + |3 |1 |34 |team A 6 |24 |354 |45 |345 |53 |25 |47 |34 + |3 |3 |45 |team B 3 |18 |303 |34 |234 |32 |48 |67 |32 + |23 |4 |22 |team C 7 |13 |322 |26 |33 |56 |57 |46 |23 + |3 |1 |14 |team D 5 |10 |353 |24 |58 |82 |35 |33 |12 + |5 |2 |35 |team E 5 |30 |264 |48 |26 |23 |23 |73 |23 + |5 |2 |65 |team F 6 |18 |363 |58* |39 |71 |35 |75 |46 + |2 |4 |23* |team_triumph ---------------------------------------------------------------------- +------------------------------------- x |x |x |x |x |x |x |x |x + |x |x |x |Total ---------------------------------------------------------------------- +------------------------------------- Score | Points | Time | Points | Record | Size | Points | Age | Points + | Difficulty | Size | Points | Name 2 |32 |443 |34 |464 |38 |89 |9 |43 + |3 |4 |353 |Team C 5 |24 |343 |543 |923 |478 |0 |35 |3 + |3 |2 |39 |Team B 6 |5 |263 |232 |92 |43 |48 |96 |46 + |4 |52 |78 |team_victory ---------------------------------------------------------------------- +------------------------------------- x |x |x |x |x |x |x |x |x + |x |x |x |Total ---------------------------------------------------------------------- +------------------------------------- Score | Points | Time | Points | Record | Size | Points | Age | Points + | Difficulty | Size | Points | Name 5 |76 |366 |37 |593 |453 |34 |68 |65 + |35 |4 |54 |Team D 3 |34 |235 |102 |967 |290 |2 |54 |2 + |3 |6 |3 |Team C 2 |643 |643 |34 |291 |10 |2 |43 |53 + |3 |7 |46 |Team F 5 |43 |362 |2 |152 |35 |35 |24 |5 + |2 |43 |7 |Team G 6 |7 |643 |6* |45 |0 |97 |75 |883 + |1 |2 |344* |team_intrepid ---------------------------------------------------------------------- +------------------------------------- x |x |x |x |x |x |x |x |x + |x |x |x |Total ---------------------------------------------------------------------- +-------------------------------------
I've been searching column "Name" for the values I want and using those rows by using
#!/usr/local/bin/perl open(my $fh, "<", "data.txt") || die "Can't open file: $!"; # Run through all lines of the file, one by one while(my $line = <$fh>) { # Break up the line on whitespace, assign columns to vars my( $score,$scorePoints, $time,$timePoints, $record,$recordPoints, $size,$sizePoints, $age,$agePoints, $diff,$diffPoints, $size2,$size2Points, $name ) = split(/\s+/,$line,13); # Check to see if name matches if($name =~ /(intrepid|triumph)/) { print "$name\n", "Time: $timePoints, Difficulty: $diffPoints\n\n"; } }

Is there a more flexible way of checking for other strings in addition to "intrepid" and "triumph", perhaps using an array and seeing if the Name column contains any values in the array? My only question is, how do I do that? And could I store these values in a separate configuration file so a user could easily change them?
Also, would there be any way of referencing the value that was discovered, i.e. "triumph", "victory", "intrepid", or any other value being searched for if a string containing that value is found?
Thanks for any help. If you wish to see a copy of the actual code I'm using right now, I received help on it in a previous node: http://perlmonks.org/index.pl?node_id=629617.

In reply to Searching for Numerous Values by Dr.Avocado

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.