I have a variable $collectors which can contain from one to seven peoples names separated by semicolons. If the string houses a single name then it will be followed by seven semicolons, if it houses two names then 5 semicolons. How can I strip out the extraneous semicolons that are at the end of the string while leaving the ones separating the actual peoples names in place?
Examples of data held in $collectors John Doe;;;;;;; John Doe;Jane Doe;;;;;; John Doe;Jane Doe;Bob Smith;;;;; etc.