lundi 21 septembre 2020

How to print specific words in the sentence that begin with pattern

I am trying to print a word that has both number and letters from a sentence that start with a specific pattern (LOCUS in this case).

#!/usr/bin/perl -w   use strict;    open (FILE, "ciona_intestinalis.gb") or die$!;    while (<FILE>) {    my $line = $_;    if ($line =~ /^LOCUS\s\w\s*([0-9_]+)/) {    my $variable = $1;    print $variable . "\n";    }    }    close FILE;

Aucun commentaire:

Enregistrer un commentaire