That's god-awful. With VCS::CMSynergy you should almost never have to parse the output of Synergy CLI command yourself.
The first thing is to stop using strings to denote the various Synergy entities, e.g. tasks. Instead wrap it in a VCS::CMSynerg::Object ("object" for short). An object stringifies to its Synergy four-part name whenever the context requires a string, so you can simply print it or use it as an argument of a CLI command. But you can also call methods on it, see below.How do you get an object? There are lots of ways. If you happen to know its four part name, say "foo.c~42:csrc:1" you can use