in reply to split versus =~

FWIW: split is using a regex, hence you could also try a negative lookbehind assertion (like /(?<!^)-/ ) to make sure a '-' at string's start isn't used for splitting.

Demo in debugger using perl -de0

DB<4> x split /(?<!^)-/, "X-Y-Z" 0 'X' 1 'Y' 2 'Z' DB<5> x split /(?<!^)-/, "-X-Y-Z" 0 '-X' 1 'Y' 2 'Z' DB<6>

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery