Help for this page

Select Code to Download


  1. or download this
    my @arr = qw( cool guy here );
    my $str = "I am cool";
    ...
    if ($str =~ $re) {      # if ($str =~ /^$re$/) {
       print "Matched\n";   #    print "Equals\n";
    }                       # }
    
  2. or download this
    use Regexp::List qw( );
    
    ...
    if ($str =~ $re) {      # if ($str =~ /^$re$/) {
       print "Matched\n";   #    print "Equals\n";
    }                       # }
    
  3. or download this
    my @arr = qw( cool guy here );
    my $str = "I am cool";
    ...
    if (grep {index($str,$_)!=-1} @arr) {  # if (grep {$str eq $_} @arr) {
       print "Matched\n";                  #    print "Equals\n";
    }                                      # }