in reply to Easiest way to do something only on first iteration of loop

TIMTOWTDI ... IMHO you should choose the best self documenting approach.

In this case I'd use a variable $index (or $idx ) for arrays and for other loops an auto-incremented $counter++

The loop may run longer due to the increment operation, but

print ' ' x $indentation if $idx == 0;

is always readable and can also be extended for last line ( $idx == $#array ) or some modulo intervals

Mr Muskrat already showed you how each can be used to get index and value in one go.

Please be aware that your flag-approach can be better readable in other cases.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!