How to determine of text matches?

From: nospam (no_at_spam.com)
Date: 08/22/04

  • Next message: Alan Connor: "[OT] Perl to C Converter?"
    Date: Sat, 21 Aug 2004 19:17:04 -0400
    
    

    In the code fragment below, I'm doing a substitution
    of the key/value pairs in a hash using s/$key/$value/g;.
    How can I determine if a match is found? I want to do
    something like:

    If (match found) {
      print "FOUND MATCH";
    }

    -Thanks

    #############################

      return unless -T;

      print "Processing==> $File::Find::name\n";

      my $obj = tie(my @array, 'Tie::File', $_) || die "$!\n";

      for (@array) {

        while ((my $key, my $value) = each %strings) {

          s/$key/$value/g;

        }

      }

       untie @array;


  • Next message: Alan Connor: "[OT] Perl to C Converter?"

    Relevant Pages

    • Hashes and scope
      ... I am trying to assign key/value pairs to a hash from a text input file. ... are evenly divided among new files glaa, glab, glac and glad.d. ...
      (perl.beginners)
    • Re: Breaking reference chians
      ... > I'm currently writing a script to read windows style config files. ... > know the sort of file ... The first line builds a hash whose keys are the section names and ... The second line transforms each set of key/value pairs into the equivalent ...
      (comp.lang.perl.misc)
    • Re: regarding hash
      ... I have sorted one array in ascending order. ... There is a way to keep hash keys in a certain order (see 'perldoc -q ... What are the key/value pairs you wish to store in a hash? ...
      (perl.beginners)
    • Re: Creating a search
      ... only key/value pairs which have a value that's not empty should ... Conditions is actually a Hash, or expecting a Hash, and indeed, this syntax ... a bit more concise. ... This does what your loop was trying to do, ...
      (comp.lang.ruby)
    • Re: Variable references in yaml files
      ... convoluted substitution hash, I can just merge a hash of on-the-fly ... Then it's a simple matter of substitution: ... get either the string '#', ... There are other problems -- I'm assuming your yaml file is a single, ...
      (comp.lang.ruby)