in reply to extract sequences of certain letters and assign it to a variable

I understood that you want to extract sequences not single characters contained in your characterclass ... (?)

so maybe you need one more + in CountZeros code to get substrings instead of letters.

please compare the differences:

use strict; use warnings; my $a = "bbzvbvxmgbnmnvxyyz"; my @all = $a =~ m/([zvxg])/g; print "@all\n"; @all = $a =~ m/([zvxg]+)/g; print "@all\n"; __END__ # OUTPUT FOLLOWS z v v x g v x z zv vx g vx z

Cheers LanX

- - - - - Which song???

  • Comment on Re: extract sequences of certain letters and assign it to a variable
  • Download Code