One thing that jumps out at me is that the code issues a lot of warnings, which makes me think you aren't actually running with warnings in place. You use a lot of array slices (e.g. @leftSide[$i] in place of $leftSide[$i]) and you use a pointless and malformed prototype for mergeSort. You also use & syntax for your method call, which dodges the prototype anyway. Please make sure you post the code you are using, and don't just slap warnings on for a post.
in reply to <SOLVED>Dereferencing arrays
When I run your code, the error you cite occurs on my line 30. It hits because when you call mergeSort on line 51, @leftSide array has 5 elements. Since you've used Prototypes, mergeSort expects a single scalar. However, you undermine the protoype system by invoking your method with &, so Perl stuffs your array in scalar context; thus the array length of 5. The general solution is don't use prototypes unless you actually know how to use them. If you change your code to read:
You will solve this particular issue, though your sort will still fail for the reasons that BrowserUk hints at.
mergeSort( @leftSide );
mergeSort( @rightSide );
merge( @leftSide, @rightSide, $data );
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.