Help for this page

Select Code to Download


  1. or download this
    #! /usr/bin/perl
    use strict;
    ...
    my $x=1;
    my @arr= qw(foo cho roh foo kho foo  moo foo);
    foreach(@arr){print  $x++ if (/foo/)}
    
  2. or download this
    #! /usr/bin/perl
    use strict;
    ...
    $str=~ /foo/;
    print $&; #### In place of $&; we can use that for no
              #### for no. of matches.