use strict; use warnings; use Data::Dumper; my $string = "> abcd1234 abcd abcd >xyz123 xyz"; my @substrings = $string =~ /(>.+)/g; print Dumper \@substrings; #### $VAR1 = [ '> abcd1234', '>xyz123 ' ]; #### $VAR2 = [ '> abcd1234', 'abcd abcd' ];
## $VAR1 = [ '> abcd1234', '>xyz123 ' ]; ##
## $VAR2 = [ '> abcd1234', 'abcd abcd' ];