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