Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL my Function
Syntax
Definition and Usage
Declares the variables in LIST to be lexically scoped within the enclosing block. If more than one variable is specified, all variables must be enclosed in parentheses
Return Value
Example
Try out following example:
#!/usr/bin/perl -w
my $string = "We are the world";
print "$string\n";
myfunction();
print "$string\n";
sub myfunction
{
my $string = "We are the function";
print "$string\n";
mysub();
}
sub mysub
{
print "$string\n";
}
|
It will produce following results:
We are the world
We are the function
We are the world
We are the world
| |
|

|
|
|