in reply to getting a sequence of numbers and leters
use strict; use warnings; use Test::Simple tests => 3; my $fname = \do { my $line = "BOGUS PPI3_SYNY3 276 aa contentar BCT 13-NOV-2019\n"; }; open my $FH, '<', $fname or die "Cannot open $fname for input"; my $content = <$FH>; close $FH; my $get_bogus = qr/ [A-Z0-9_]+ /x; my $get_acid = qr/ [0-9]+\s[a-z]+ /x; my ( $bogus, $acids ) = $content =~ / BOGUS \s+ ($get_bogus) \s+ ($get_acid) /x; if (ok( ( defined($bogus) and defined($acids) ), 'Match') ) { ok( $bogus eq "PPI3_SYNY3" , "extracted '$bogus'"); ok( $acids eq '276 aa', "extracted '$acids'"); }
OUTPUT:
1..3 ok 1 - Match ok 2 - extracted 'PPI3_SYNY3' ok 3 - extracted '276 aa'
|
|---|