[comp.lang.perl] Quoted Split for perl?

brian@oddjob.uchicago.edu (Brian Yanny) (06/28/90)

Does anyone have a 'quoted split' subroutine?
that is, it would do things like this:

---------------
$a='this string has "embedded quote marks" dont ya know';

@out=do quoted_split(' ',$a);

for ($i=0;$i<=$#out,$i++){
	print "$i $out[$i]\n";
}

--------------
When run would produce:

0 this
1 string
2 has
3 embedded quote marks
4 dont
5 ya 
6 know

---------------

It could get fancier and handle either '"' or "'" (nested) too.