http://qs321.pair.com?node_id=11114572


in reply to getting a sequence of numbers and leters

It should be doable using a single regex:
#!/usr/bin/perl use warnings; use strict; my $line = "BOGUS PPI3_SYNY3 276 aa linear BCT 13-NOV-2019\n"; if (my ($bogus, $acids) = $line =~ /BOGUS\s+([A-Z0-9_]+) ([0-9]+ [a-z] ++)/) { print "bogus: $bogus\nNumber of acids: $acids\n" }

Your code is unfortunately incomplete. How did you populate $noOfAcids? Also, $ in the second regex can't match after "aa", as the string doesn't end there. Note that $1 et al. are only changed after a successful match, so if the second regex doesn't match, the value of $1 keeps the value from the previous match.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]