In the Beginning every part of your program had access to all the variables in every other part of the program. That turned out to be a problem, so language designers invented local variables, which were visible in only a small part of the program. This article discusses the difference between package variables and lexical variables. Topics include: global variables, lexical variables, local declaration, my declaration, my variable, package declaration, package qualifier, package variable, private variable, scope, use strict vars, and use vars.
My log file has nothing in it. My output is coming out in the wrong order. When my program terminates abnormally, the output is incomplete. My web server says I didn't send the right headers, but I'm sure I did. I'm trying to send data over the network, but nothing is sent. If this is you, I'm afraid you're probably a victim of buffering. For efficiency, Perl uses a trick called buffering to reduce the amount of system resources it uses. This article will teach you how to get around buffering by flushing or disabling buffering all together.