in reply to Regex: Matching quoted text

This regex could be tweaked a bit so that it doesn't "throw" undefined values into @tokens. But this appears to do what you want in a very straightforward way.
#!/usr/bin/perl -w use strict; while (<DATA>) { print "input: $_"; my @tokens = grep{defined($_)}m/"(.*?)"|(\S+)/g; foreach my $tok (@tokens) { print " $tok\n"; } } #or while (<DATA>) { print "input: $_"; my @tokens = m/"(.*?)"|(\S+)/g; foreach my $tok (@tokens) { next unless defined($tok); print " $tok\n"; } } =prints input: - "adf adf" - "something else" - adf adf - something else input: "another line" - - "adf" another line - - adf input: abc = 24 "adf adf" abc = 24 adf adf input: -56 ouy "97 lkh wer" - 87 -98 -56 ouy 97 lkh wer - 87 -98 =cut __DATA__ - "adf adf" - "something else" "another line" - - "adf" abc = 24 "adf adf" -56 ouy "97 lkh wer" - 87 -98