Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL my Function



Syntax

my LIST


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

  • Nothing

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


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names