in reply to Re^3: Getting data from a file (Operons and Genes).
in thread Getting data from a file (Operons and Genes).
#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?#!/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"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Getting data from a file (Operons and Genes).
by thezip (Vicar) on Jun 15, 2007 at 00:18 UTC |