http://www.perlmonks.org?node_id=1091892


in reply to Re: Gettting the last Friday of every month using Time::Piece
in thread Gettting the last Friday of every month using Time::Piece

++gurpreetsingh13. By your use of meaningful variable names and explanatory comments, your script explains what it does and how it does it. One is able to understand your algorithm by reading just the script itself, without having to refer to any module documentation.

This…

my $daysToMoveBack = 0; $weekDay >= 6 ? ( $daysToMoveBack = $weekDay - 6 ) : ( $daysToMove +Back = $weekDay + 1 );

…is more succinctly written like this…

my $daysToMoveBack = $weekDay >= 6 ? $weekDay - 6 : $weekDay + 1;