in reply to Modification of a read-only value attempted

 (($data =~ m/^\-\w/) || ($data =~ m/^\-/))

I don't see what purpose the first match there has since it appears to be a special case of the second one. Can you explain?