#!/usr/bin/perl use warnings; use strict; x(); # this will trigger a warning my $shared = 'abc'; sub x { print "\$shared is: <$shared>\n"; } x(); # this will work fine