#!/usr/local/apps/perl/bin/perl ######################################################################## # # # WHO: John L. Moreland # # # # WHAT: proto # # # # WHY: Demonstrates the use of subroutine prototypes # # and "new" style subroutine calls. # # # # WHERE: Opus Software # # # # WHEN: Thu Sep 11 17:26:16 PDT 1997 # # # # HOW: PERL # # # ######################################################################## sub TwoScalars($$;) { my( $a, $b ) = @_; print "a=$a, b=$b\n"; } ############################################################################# ################################## MAIN ################################### ############################################################################# # # A "new" style call has no "&" character in front of the subroutine name # &TwoScalars( "Hello" ); # OK (old style call) TwoScalars( "Hello" ); # Wrong (new style call, too few arguments) TwoScalars( "Hello", "World" ); # Right (new style call) @foo = ( "Hello", "World" ); TwoScalars( @foo ); # Wrong (new style call, too few arguments) TwoScalars( $foo[0], $foo[1] ); # Right (new style call)