Help for this page

Select Code to Download


  1. or download this
    @molecules = <MOL>;
    map { chomp; $_ = quotemeta; } @molecules;
    
  2. or download this
    push my @molecules, quotemeta chomp while <MOL>;
    
  3. or download this
    $bigRegex = join '|', @molecules;
    
  4. or download this
    my $bigRegex;
    ($bigRegex .= join( '|', '\b'. $_ . '\b' ) ) for @molecules;
    
  5. or download this
    my $bigRegex;
    $bigRegex = join '|', map { "\b$_\b" } sort { length $b <=> length $a 
    +} @molecules;
    
  6. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
        print if( scalar( split /\t/ ) >= 6 
            && /^([^\t]*\t)?($bigRegex)/ );
    }