fork download
  1. #!/usr/bin/env perl
  2.  
  3. use strict;
  4. use warnings;
  5. use Data::Dumper;
  6.  
  7. my @a = ();
  8. # list context
  9. my @b = @a;
  10. # @a = (100, 200, 300);
  11. $a[0] = 100; $a[1] = 200; $a[2] = 300;
  12. print Dumper({ a => \@a, b => \@b, });
  13.  
Success #stdin #stdout 0.01s 5164KB
stdin
Standard input is empty
stdout
$VAR1 = {
          'a' => [
                   100,
                   200,
                   300
                 ],
          'b' => []
        };