Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: string match using with an N in any position

by jwkrahn (Monsignor)
on Nov 18, 2011 at 02:57 UTC ( #938729=note: print w/ replies, xml ) Need Help??

in reply to string match using with an N in any position

You could probably do something like this:

# reading in each query string (file1) into an array my @barcode; while ( my $line1 = <INP1> ) { chomp $line1; my @temp = ( $line1, ( $line1 ) x length $line1 ); substr $temp[ $_ ], $_, 1, 'N' for 0 .. $#temp - 1; local $" = '|'; push @barcode, [ $line1, qr/@temp/ ]; } for my $code ( @barcode ) { my $filename = $code->[ 0 ]; open OUT, '>', $filename or die "Cannot open '$filename' because: +$!"; # I have stored each of the query strings in a hash. # The value of the hash contains the target strings. # The keys are 1,2,3... for my $value ( values %idhash ) { if ( $value =~ /^$code->[1]/ ) { # where the query string matches the target # string print value of the hash print "$value\n"; } } }

Comment on Re: string match using with an N in any position
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938729]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2015-11-28 12:31 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (741 votes), past polls