Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2015-07-08 06:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls