Chris Stinemetz wrote:
***tested***

#!/usr/bin/perl
use warnings;
use strict;

while (<DATA>  ) {
  chomp;
  my @array = split;
  my $GeneID = $array[6];

  if ($GeneID =~ /^C|D/) {

I'm still learning regex but it could be better written with;
if ($GeneID =~ /^[CD]/) {

Plus they do two different things. /^C|D/ matches 'C' at the beginning of the string OR 'D' anywhere in the string while /^[CD]/ will match either 'C' or 'D' at the beginning of the string.



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to