do  construct

This is the most difficult of the three to understand; the others are just slightly varied forms of do . 

do will look for a file by searching the @INC path (more on that later). If the file can't be found, it'll silently move on. If it is found, it will run the file just as if it was placed in a block within our main program – but with one slight difference: we won't be able to see lexical variables from the main program once we're inside the additional code. So if we have a file dothis.pl : 

#!/usr/bin/perl 
# dothis.pl
$a = "Been there, done that, got the T-shirt";

do "printit.pl";

a file printit.pl : print "a=$a\n";

we'll get no output, not even a warning that $a is uninitialized within printit.pl , because we didn't turn on warnings in our included file. On the other hand, we can have subroutines in our included file and call them from the main file.