N.: Anordnung Subroutines

Beitrag lesen

Eindeutig nach alter Pascal-Konvention gehören Subs vor den Hauptteil.

Geht:

  
    use strict;  
    sub foo {  
        say 'hello';  
    }  
    foo;  

Geht nicht:

  
    use strict;  
    foo;  
    sub foo {  
        say 'hello';  
    }  
  
    Bareword "foo" not allowed while "strict subs" in use at [...]  
    Execution [...] aborted due to compilation errors.  

PS: Wer parameterlose Subs mit runden Klammern aufruft, ist ein Javaweichspüler.