in reply to Re: Getting data from a file (Operons and Genes).
in thread Getting data from a file (Operons and Genes).
Yes, thanks, I was trying somethign like this and failing.
<code>
#!/usr/bin/perl
use strict;
my $operon;
my %operonHash;
while (<>) {
chomp;
if ( /(\b.+?\b)/ ) { # word boundary + any character at least once, up to the first word boundary.
#print "Matched: |$`<$&?>$'|\n";
$operon = $_;
#print $& . " " ;
$operonHash{$&} = ();
} else {
print "No match. \n";
}
print "\n";
if ( /\w+\|/ ) { # word boundary + any character at least once, up to the first word boundary.
print "Matched: |$`<<$&>>$'|\n";
} else {
print "No match. \n";
}
}
<\code>
#The problem is, 1. How to get rid of the | from the expression that was found, and 2. How to get MULTIPLE genes before | when more than one gene appears on a line?