Skip to content

Instantly share code, notes, and snippets.

@hercynium
Created July 17, 2009 14:54
Show Gist options
  • Save hercynium/149089 to your computer and use it in GitHub Desktop.
Save hercynium/149089 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use feature ":5.10";
my @ar = qw( a b c d );
my $ar_ref = \@ar;
say @ar; # abcd
say @$ar_ref; # abcd - same array, so same contents
# $#ar is the index of the last element in @ar
say $#ar; # 3
say $#$ar_ref; # 3 - same array, same index
say $#($ar_ref); # warning!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment