AAA * BBB CCC * * "2000 01 00 00 00" "2004 01 00 00 00" or AAA * BBB "CCC DDD" * * "2000 01 00 00 00" * #### * BBB CCC * * 2000 01 00 00 00 2004 01 00 00 00 #### #! /usr/bin/perl use strict ; use warnings ; my $inp = 'AAA * BBB CCC * * "2000 01 00 00 00" "2004 01 00 00 00"' ; my @r = $inp =~ /"([^"]*)"|\s+([^\s]*)(?:\s|$)/g ; local $" = "\n"; print "@r"; #### Use of uninitialized value in join or string at ./t9.pl line 13. ...... 6 more lines like this ..... * CCC * 2000 01 00 00 00 "2004 00 00"