Yurttas/PL/SL/perl/F/03/index page

From ZCubes Wiki
Jump to navigation Jump to search
Dr. Salih Yurttas - yurttas@zcubes.com
programming languages - design principles, implementation constructs
perl

  1. subroutines (functions, methods)


to declare without definition :

sub NAME
sub NAME PROTO
sub NAME       ATTRS
sub NAME PROTO ATTRS


to declare with definition, BLOCK is added :

sub NAME             BLOCK
sub NAME PROTO       BLOCK
sub NAME       ATTRS BLOCK
sub NAME PROTO ATTRS BLOCK


to create anonymous subroutine or closure, NAME is omitted :

sub             BLOCK
sub PROTO       BLOCK
sub       ATTRS BLOCK
sub PROTO ATTRS BLOCK

    1. subroutines (functions, methods)
    2. library functions

1 | perl language fundamentals << 3 >> pattern matching | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12