|
Subroutines Perl subroutines encapsulate blocks of code in the usual way. You do not need to define subroutines before they are used, so Perl programs generally have their "main" code first, and their subroutines laid out toward the bottom of the file. A subroutine can return a scalar or an array.
$x = Three(); ## call to Three() returns 3 exit(0); ## exit the program normally sub Three { return (1 + 2); }
<<prev >>next
|
|
This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start
|
Prev << Strings and Regular Expressions
|
Next >> Running External Programs
|