M
mmosher
.... doing exactly what its supposed to do.
I wrote a perl script to allow me to look at portions of the log that is
kept for people searching. It was written some time ago and seemed to
work perfectly. It was not until last week that I noticed that after
12pm the time would jump back an hour and stay that way until 12am. I
suspected a bug but doubled check incase of some weird virus or something.
Of course it was a bug:
if (substr($date_time_raw[$loop],8,2)<12) {##do something}
elsif (substr($date_time_raw[$loop],8,2)=12) {##do something}
else
{##do something}
Of course the error is in the elsif statement it should be ==12 not =12.
So of course it works in the am the pm messes up.
My question is this: I thought a syntax error of this type would not run
and that I would get an error with no output? Or is this type of error
considered a warning?
I am fairly inexperienced in perl and usually have to write stuff as "we
need this up tommorrow. Figure it out quick" kinda of situation which is
not a good way to actually learn and understand. I also do most of perl
work in the morning and it did not occur to change the clock and test
different hours. Lesson learned.
Thank you.
I wrote a perl script to allow me to look at portions of the log that is
kept for people searching. It was written some time ago and seemed to
work perfectly. It was not until last week that I noticed that after
12pm the time would jump back an hour and stay that way until 12am. I
suspected a bug but doubled check incase of some weird virus or something.
Of course it was a bug:
if (substr($date_time_raw[$loop],8,2)<12) {##do something}
elsif (substr($date_time_raw[$loop],8,2)=12) {##do something}
else
{##do something}
Of course the error is in the elsif statement it should be ==12 not =12.
So of course it works in the am the pm messes up.
My question is this: I thought a syntax error of this type would not run
and that I would get an error with no output? Or is this type of error
considered a warning?
I am fairly inexperienced in perl and usually have to write stuff as "we
need this up tommorrow. Figure it out quick" kinda of situation which is
not a good way to actually learn and understand. I also do most of perl
work in the morning and it did not occur to change the clock and test
different hours. Lesson learned.
Thank you.