ExReg has asked for the wisdom of the Perl Monks concerning the following question:
Just seeking enlightenment here. Already can get it to do what I want, but... I was typing in a few things to get them in the exact format I wanted when I ran into a peculiarity. When I enter
perl -e '($s,$m,$h,$md,$mo,$y,$w,$g,$i)=localtime;print $y+1900 . "." . ($mo+1) . ".$md." . ($h-5) . "$m\n";'I get 2019.8.1.19.47. (I hope I transcribed the above correctly)
But if I type
perl -e '($s,$m,$h,$md,$mo,$y,$w,$g,$i)=localtime;print $y+1900 . "." . $mo+1 . ".$md." . ($h-5) . "$m\n";'I get 2020.7.1.19.47. The +1 after $mo now gets applied to $y instead. The same is true for the parentheses around $h. I am trying to wrap my feeble mind around this one. What is going on?
Back to
Seekers of Perl Wisdom