This is certainly shorter, but I doubt it fully adheres to your intent. It produces the same output as your procedure for this string, but it is possible that I changed some of the meaning of what you were trying to do:
-------BEGIN CODE------- #!/usr/bin/perl use warnings; use strict; print join "\n", parse_words("\"mother's apple pie\" <randy 'lewis'>apple, corn dog,0 1 2"); sub parse_words { my $text = shift or die "Please provide a text argument to parse_words().\n"; my @return; my @delimiters = qw(" " < > ' ' { } [ ] \\( \\) # #); while (@delimiters) { my ($begin, $end) = splice @delimiters, 0, 2; push @return, $1 while $text =~ s/$begin(.*?)$end//; } push @return, $1 while $text =~ s/,? *(.*?), *//; push @return, grep { length } split ' ', $text; return @return; } -------END CODE------- "Beau E. Cox" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi - > > I am trying to come up with a simple, elegant word parsing script, that: > > * takes a scalar string, and > * splits it into words separating on white space, commas, > and a set of delimiters: "" '' // () {} [] ##, and > * returns the array of words. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>