P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
If you are absolutely certain that the format position of this attribute won't change, my preference (like mscerra's) is to use split. Being slightly neurotic, I'd check whether the return value actually exists before printing it.
If you're less certain about the postion, but still certain about the general formatting, a hash may be your best bet. This seems close to the spirit of your post. Something like this code may be a reasonable start: What's happening here is fairly simple: the string is being split on equal signs and commas, with the items to the left of the equal signs being used as the keys to a hash.
emc Experience is a hard teacher because she gives the test first, the lesson afterwards. In reply to Re: How do I get only one item out of attribute?
by swampyankee
|
|