#!/usr/bin/perl -w use strict; use warnings; &foo1; sub foo1 { local $b=1; &foo2; print "$b\n"; } sub foo2 { print "$b\n"; $b++; }