Jump to content

Arrays: Difference between revisions

→‎{{header|Perl}}: Migrating from http://rosettacode.org/wiki/Creating_an_Array
(Added XLISP)
(→‎{{header|Perl}}: Migrating from http://rosettacode.org/wiki/Creating_an_Array)
Line 3,759:
 
=={{header|Perl}}==
 
In-line
 
<lang perl> my @empty;
my @empty_too = ();
my @populated = ('This', 'That', 'And', 'The', 'Other');
print $populated[2]; # And
my $aref = ['This', 'That', 'And', 'The', 'Other'];
print $aref->[2]; # And
</lang>
 
Dynamic
Line 3,770 ⟶ 3,782:
 
print $arr[0];</lang>
 
Two-dimensional
 
<lang perl> my @multi_dimensional = (
[0, 1, 2, 3],
[qw(a b c d e f g)],
[qw(! $ % & *)],
);
</lang>
 
=={{header|Perl 6}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.