fork download
  1. #!/usr/bin/perl
  2. # your code goes here
  3.  
  4. use strict;
  5. use warnings;
  6. use diagnostics;
  7. use feature 'say';
  8.  
  9. use Data::Dumper;
  10.  
  11. my @names = qw(Foo Bar Baz);
  12.  
  13. my $names_ref = \@names;
  14. my $hash = {'first' => $names_ref};
  15. print Dumper $hash;
  16. say $$names_ref[0];
  17. say $names_ref->[0];
  18. say $hash->{'first'}[0];
  19. say $hash->{'first'}->[0];
  20. my $temp = $hash->{'first'};
  21. print Dumper $temp;
  22. say $temp->[0];
  23. say $$temp[0];
  24. $temp->[0] = [@$temp];
  25. print Dumper $temp;
  26. say $temp->[0][0];
  27.  
Success #stdin #stdout 0.08s 11080KB
stdin
Standard input is empty
stdout
$VAR1 = {
          'first' => [
                       'Foo',
                       'Bar',
                       'Baz'
                     ]
        };
Foo
Foo
Foo
Foo
$VAR1 = [
          'Foo',
          'Bar',
          'Baz'
        ];
Foo
Foo
$VAR1 = [
          [
            'Foo',
            'Bar',
            'Baz'
          ],
          'Bar',
          'Baz'
        ];
Foo