Help for this page

Select Code to Download


  1. or download this
      for (@words) {
        print if /foo/;
      }
    
  2. or download this
      my $s = "foo";
      for (@words) {
        print if /$s/;
      }
    
  3. or download this
      my($s1, $s2) = qw/ foo bar /;
      for (@words) {
        print if /$s1/;
        print if /$s2/;
      }
    
  4. or download this
      my @s = qw/ foo bar /;
      for (@words) {
    ...
          print if /$s/;
        }
      }
    
  5. or download this
      my @s = map qr{$_}, qw/ foo bar /;
      for (@words) {
    ...
          print if /$s/;
        }
      }