#!/usr/bin/perl use strict; use warnings 'all'; &test; sub test { my $var = 1; sub test2 { print $var."\n"; } &test2; }