#!/usr/bin/perl -w #didn't use strict, to make the example clearer. $foo = 3; #default value of $foo { local $foo = 5; #now the value of $foo is 5 while inside the braces print "$foo\n"; # prints 5. } print "$foo\n"; # prints 3.