#! perl use strict; use warnings; my $string = < abcd1234 abcd abcd >xyz123 xyz END if ($string =~ />(.*?)\n(.*?)>/s) { print "First substring is '$1'\n"; print "Second substring is '$2'\n"; } #### 0:23 >perl 497_SoPW.pl First substring is ' abcd1234' Second substring is 'abcd abcd ' 0:23 >