Call a function: Difference between revisions

Content added Content deleted
(Added zkl)
m (Added barebones Perl 5 entry)
Line 1,088: Line 1,088:


Most arguments are passed by reference. Some built-in functions accept arguments (e.g., flags) that are not <code>GEN</code>s; these are passed by value or reference depending on their [[C]] type. See the User's Guide to the PARI Library section 5.7.3, "Parser Codes".
Most arguments are passed by reference. Some built-in functions accept arguments (e.g., flags) that are not <code>GEN</code>s; these are passed by value or reference depending on their [[C]] type. See the User's Guide to the PARI Library section 5.7.3, "Parser Codes".

=={{Header|Perl}}==
<lang perl>foo();
&foo('foo', 'bar'); # Older style syntax with explicit sigil
foo; # Bareword syntax only works after the function declaration
foo 'foo', 'bar'; # As a list operator

# Coderef syntax, for references obtained by assigning a subroutine to a
# scalar or by taking a reference with the \ operator
&$fooref('foo', 'bar');
&{$fooref}('foo', 'bar');
$fooref->('foo', 'bar');</lang>


=={{header|Perl 6}}==
=={{header|Perl 6}}==