Help for this page

Select Code to Download


  1. or download this
    my $last_match;
    if ( grep { /^tag\: (.*)$/ and $last_match = $1 and 1} <FILE> ) {
            print "Found tag: $last_match\n";
    }
    
  2. or download this
    while (<FILE>) {
       next unless /^tag\: (.*)$/;
       print "Found tag: $1\n";
    }
    
  3. or download this
    print map /^tag\: (.*)$/ ? "Found tag: $1\n" : (), <FILE>;