The first thing that screamed at me when reading your code is that this:

sub mergeSort( \@arrayRef ) {

Isn't a legal Perl construct. And sure enough, running a syntax check on your code exactly as posted produces:

C:\test>perl -c junk92.pl Illegal character in prototype for main::mergeSort : \@arrayRef at jun +k92.pl line 27. Scalar value @leftSide[$i] better written as $leftSide[$i] at junk92.p +l line 40. Scalar value @leftSide[$i] better written as $leftSide[$i] at junk92.p +l line 41. Scalar value @rightSide[$i - $middle] better written as $rightSide[$i +- $middle] at junk92.pl line 47. Scalar value @rightSide[$i - $middle] better written as $rightSide[$i +- $middle] at junk92.pl line 48. Prototype mismatch: sub main::mergeSort (\@) vs (\@arrayRef) at junk92 +.pl line 55. Scalar value @groupA[$i] better written as $groupA[$i] at junk92.pl li +ne 62. Scalar value @groupB[$j] better written as $groupB[$j] at junk92.pl li +ne 62. Scalar value @groupA[$i] better written as $groupA[$i] at junk92.pl li +ne 63. Scalar value @groupB[$j] better written as $groupB[$j] at junk92.pl li +ne 67. Scalar value @groupA[$i] better written as $groupA[$i] at junk92.pl li +ne 73. Scalar value @groupB[$j] better written as $groupB[$j] at junk92.pl li +ne 78. junk92.pl syntax OK

Which means you've either been ignoring the messages; or you added strict and warnings for posting.

Fix that lot, then come back and someone will explain to you why this will never work:

my ( @groupA, @groupB, $dataRef ) = @_;

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Dereferencing arrays by BrowserUk
in thread <SOLVED>Dereferencing arrays by divitto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.