Help for this page

Select Code to Download


  1. or download this
    my @matching elements=grep /$wahtever/, @array;
    print $_, "\n" for @matching elements;
    # But then just:
    # print $_, "\n" for grep /$wahtever/, @array;
    # if you don't need @matching elements elsewhere
    
  2. or download this
    foreach (@array) {
        print "Matched :$_:\n" if /$value/;
    }
    
  3. or download this
    /$value/ and print "Matched :$_:\n" for @array;