title: Please explain perl statement
body: <p>I am reading Intermediate Perl book and in Chapt10 there is this code. I added few print statements but core logic is untouched.</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  use Data::Dumper;
  
  my @input = qw(Gilligan Skipper Professor Ginger Mary Ann);
  my @sorted_positions = sort { $input[$a] cmp $input[$b] } 0 .. $#input;
  print Dumper( \@sorted_positions );
  my @ranks;
  @ranks[@sorted_positions] = ( 1 .. @sorted_positions );
  print Dumper( \@ranks );
  foreach ( 0 .. $#ranks ) {
      print "$input[$_] sorts into position $ranks[$_]\n";
  }
  </code></pre>
  
  <p>When i check the Dumper output then for <code>@sorted_positions</code> array it is printing </p>
  
  <pre><code>$VAR1 = [
            5,
            0,
            3,
            4,
            2,
            1
          ];
  </code></pre>
  
  <p>which make sense to me but for <code>@ranks</code> array it is printing </p>
  
  <pre><code>$VAR1 = [
            2,
            6,
            5,
            3,
            4,
            1
          ];
  </code></pre>
  
  <p>I am unable to understand what this line is doing.</p>
  
  <pre><code>@ranks[@sorted_positions] = ( 1 .. @sorted_positions );
  </code></pre>
  
  <p>I am able understand what output means in reference to the program but not able to understand how that output is coming i.e. what exactly is perl doing inside that statement. </p>