in reply to Unable to declare local variable with "use strict".

You may find a read through of local informative, particularly the first line:

You really probably want to be using my instead, because local isn't what most people think of as "local".

This might also be confusion on your part about what strict does. As best as I can tell, your code (maybe) does what you expect by declaring a $type variable at the script level and swapping your local statement to a my - this results in creating a localized $type variable in ref_test1 and a closure around the script-level variable in ref_test2:

#!/usr/bin/perl -w use strict; my $type = "some line"; ref_test1(); sub ref_test1 { my $type="connect"; print "Here in ref_test1.\n"; ref_test2(); } sub ref_test2 { print "Type: $type\n"; print "Here in ref_test2\n"; } __END__ Here in ref_test1. Type: some line Here in ref_test2