Help for this page

Select Code to Download


  1. or download this
    %matches = ( name=>[1, 3,5,6,9],
          desc=>[2,6,7]
     );
    
  2. or download this
    
     my %matches;
     $matches{name} = [ grep { $names[$_] =~/$pattern/ } 0 ..$#names ];
     $matches{desc} = [ grep { $desc[$_] =~/$pattern/} 0.. $#desc];
    
  3. or download this
    my @matches = grep { $names[$_] =~ /$pattern/ || 
       $desc[$_] =~/$pattern/ } 
        0 .. $#names;