in reply to Splitting on double quotes
split will return not only the values within the quotes but also what's outside of them.
Here I would use the fact that "attribute values" follow an = sign and do:
#!/usr/bin/perl -w use strict; while( <DATA>) { chomp; my @atts= (m{= # an equal sign \s* # optional spaces " # a double quote ([^"]*) # capture while no double quote " # the closing double quote }gx); print "$_: ", join( "-", @atts), "\n"; } __DATA__ type="car" of make="Ford" color="red" type="car" of make="Ford" color="red" foo foo= type="car" of make="Ford" color="red" foo foo= type="car=" of make="Ford" color="red" foo
|
|---|