in reply to Formatting variables

Programming is my hobby, so when I write code, I don't have a boss to tell me "This is how you're going to do it or you're fired." But I like to write my variables in this format:

$VariableName
SubName();

Sometimes, I switch to all caps when I use a global variable or an important value.

my $DEBUG = 1;
my $GLOBAL_VARIABLE_NAME = 'hello';

If there's a function or sub that is part of a larger group of subs or "class," I might use an underscore character to divide the name:

Chart_DrawGrid();
Chart_Open();
Chart_Close();
Chart_Move();

If I need to create a "low-level function" that I only call from within certain functions or a function that is called many-many times and needs to be high performance, then I start its name with an underscore:

_FormatName();
_SaveValues();
_RecalculateSize();

For braces, each opening and closing brace goes on a new line, and indentation is always 2 spaces (I don't like to use tabs). In for loops, I like to use single-letter variables in lowercase that starts with $i, $j, $k... I like to avoid using $l because the lowercase L looks like a number 1. That gets confusing very quickly, so I will pick a variable name like $g or $f or something else instead of $l.

for (my $i = 0; $i < 43; $i++)
{
  ...
}