Compound data type: Difference between revisions

Content added Content deleted
m (Fixed lang tags.)
(Added to the perl section)
Line 466: Line 466:
=={{header|Perl}}==
=={{header|Perl}}==
{{works with|Perl|5.x}}
{{works with|Perl|5.x}}
===Built-in Hash===
This is a hash (associative array), but accomplishes the task.
This is a hash (associative array), but accomplishes the task.
<lang perl>my %point = (
<lang perl>my %point = (
Line 471: Line 472:
y => 8
y => 8
);</lang>
);</lang>

===Built-in Array===
<lang perl>my $point = [3, 8];</lang>

===Class===
<lang perl>package Point;

use strict;
use base 'Class::Struct'
x => '$',
y => '$',
;

1;

my $point = Point->new(x => 3, y => 8);</lang>


=={{header|PHP}}==
=={{header|PHP}}==