Queue/Definition: Difference between revisions

Content added Content deleted
m (Order of sections.)
m (→‎{{header|Perl}}: future-proof for 5.36, explicit :prototype)
Line 4,783: Line 4,783:


<syntaxhighlight lang="perl">use Carp;
<syntaxhighlight lang="perl">use Carp;
sub mypush (\@@) {my($list,@things)=@_; push @$list, @things}
sub my push :prototype(\@@) {my($list,@things)=@_; push @$list, @things}
sub mypop (\@) {my($list)=@_; @$list or croak "Empty"; shift @$list }
sub maypop :prototype(\@) {my($list)=@_; @$list or croak "Empty"; shift @$list }
sub empty (@) {not @_}</syntaxhighlight>
sub empty :prototype(@) {not @_}</syntaxhighlight>


Example:
Example: