Next Up

Some code with side comments

Here is the input file sidecmt.t:
my $lines  = 0; # checksum: #lines
my $bytes  = 0; # checksum: #bytes
my $sum  = 0; # checksum: system V sum
my $patchdata = 0; # saw patch data
my $pos  = 0; # start of patch data
my $endkit = 0; # saw end of kit
my $fail  = 0; # failed

The command perltidy sidecmt.t produces a file named sidecmt.t.tdy with this result:
my $lines     = 0;    # checksum: #lines
my $bytes     = 0;    # checksum: #bytes
my $sum       = 0;    # checksum: system V sum
my $patchdata = 0;    # saw patch data
my $pos       = 0;    # start of patch data
my $endkit    = 0;    # saw end of kit
my $fail      = 0;    # failed

This example shows how perltidy lines up equals signs and side comments.
Next Up