Help for this page

Select Code to Download


  1. or download this
    my $x=1;
    foreach(@arr){print  $x++ if (/foo/)}
    
  2. or download this
    my $str=join ' ',@arr;
    
  3. or download this
    $str=~ /foo/;
    
  4. or download this
    print $&; #### In place of $&; we can use that for no
              #### for no. of matches.