Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: pattern match with different sets.

by ig (Vicar)
on Jun 17, 2011 at 17:35 UTC ( #910225=note: print w/ replies, xml ) Need Help??

in reply to pattern match with different sets.

It would be easier to help you if you posted actual code rather than the vague description "and comparing the $m ==$m1 and also /(\w+)(a|b|c). and comparing the $1 of one sample with the other".

It's only a guess but maybe something like the following would do what you want.

use strict; use warnings; my @samples = qw( PD4005a PD4005b PD4005c WGA_PD4005a WGA_PD4005b WGA_PD4005c DIFFERENT ); foreach my $s1 (@samples) { foreach my $s2 (@samples) { next if(compare($s1,$s2)); print "$s1 - $s2\n"; } } sub compare { my ($s1, $s2) = @_; if($s1 =~ m/^(WGA_)?PD(\d+)[abc]$/) { my $n1 = $2; if($s2 =~ m/^(WGA_)?PD(\d+)[abc]$/) { return($n1 == $2); } } return(0); }

Comment on Re: pattern match with different sets.
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2015-11-26 13:29 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 (700 votes), past polls