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;

Replies are listed 'Best First'.
Re^3: Gettting the last Friday of every month using Time::Piece
by gurpreetsingh13 (Scribe) on Jul 02, 2014 at 03:28 UTC
    Great thanks for the correction and improvement.