CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
unmatched ( ?

 



lily3344
New User

Dec 15, 2008, 6:10 PM

Post #1 of 3 (2625 views)
unmatched ( ? Can't Post

This might be dumb question but I have the following script:

while (my $proteins = <$INPUT>) {
my @species = ("dmelanogaster","dsimulans");

foreach my $species (@species) {
if ($proteins =~ /$species/) {
push (my @keys, $proteins);
}else {
(my $mel, my $sim) = $proteins =~ /^([\w\]) ([\t\w\])$/; ## Here tell me that there is a unmatch ( in the regex?
push @mel, $mel;

foreach ($sim =~ s/\s*$//) {
push @sim, $sim;
}
}
}
}
I am trying to get my values sort out from a input file that look somthing like this

dmelanogaster dsimulans
FBpp0070035 FBpp0217127
FBpp0070058 FBpp0208957
FBpp0070115 FBpp0214920
FBpp0070228 FBpp0214829
FBpp0070744 FBpp0215135

please help me!!


KevinR
Veteran


Dec 15, 2008, 9:56 PM

Post #2 of 3 (2619 views)
Re: [lily3344] unmatched ( ? [In reply to] Can't Post

if anything it should be unmatched [ The problem is the backslash escaping the ] in the regexp:

/^([\w\]) ([\t\w\])$/

change to:

/^([\w]) ([\t\w])$/

although the first one is redundant because \w is a character class, there is no need to put it inside of a character class by itself:

/^(\w)([\t\w])$/
-------------------------------------------------


lily3344
New User

Dec 15, 2008, 10:07 PM

Post #3 of 3 (2616 views)
Re: [KevinR] unmatched ( ? [In reply to] Can't Post

Thank you so much, you are a life saver!!

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives