Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL local Function



Syntax

local LIST


Definition and Usage

Sets the variables in LIST to be local to the current execution block. If more than one value is specified, you must use parentheses to define the list. Note that local creates a local copy of a variable, which then goes out of scope when the enclosing block terminates. The localized value is then used whenever it is accessed, including any subroutines and formats used during that block.

Return Value

Nothing

Example

Following is the example:

#!/usr/bin/perl -w

local $foo;			# make $foo dynamically local
local (@wid, %get);		# make list of variables local
local $foo = "flurp";	        # make $foo dynamic, and init it
local @oof = @bar;		# make @oof dynamic, and init it



Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names