Help for this page

Select Code to Download


  1. or download this
    # 1.
    my $any   = qr/one|two|three/;
    
    ...
    # 3.
    my @pats  = qr/one/, qr/two/, qr/three/;
    my $any   = qr/$pat[0]|$pat[1]|$pat[2]/; # ick
    
  2. or download this
    my @pats  = map qr/$_/, @some_input;
    my $any   = ??? # no resort to explicit indices
    
  3. or download this
    my $joined = join ")|(?:", @some_input;
    my $any    = qr/(?:$joined)/;