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

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am new at perl so any help is appreciated. I am trying to write something along the lines of a date function. Essentially I want to return yesterdays date but I am having problems with my if statements.
use strict; use warnings; ### Date my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime +(); $year += 1900; $mday -= 1; if ($mday == 0) { $month -= 1; } if ($month == 1||3||5||7||8||10||12) { $mday = 31; } elsif ($month == 4||6||9||11) { $mday = 30; } elsif ($month == 2) { print "is this a leap year"; } if ($month == 0) { $year -= 1; $month = 12; } print ($sec."\n",$min."\n",$hour."\n",$mday."\n",$month."\n",$year."\n +",$wday."\n",$yday."\n",$isdst."\n");
I'm pretty sure the problem will be with my style. I simply cant find whats wrong with it? The output is below
56 45 11 31 7 2013 5 213 1
It should read as:
56 45 11 1 7 2013 5 213 1