in reply to Re: Converting between localtime scalar and list contexts
in thread Converting between localtime scalar and list contexts
which might seem more "natural", you leave yourself open to a very subtle and obsure bug: What if the second changes between one of those calls? It might look like an "off-by-one" error, but it only happens "sometimes". Maybe nothing serious happens. But what if midnight occurs between one of those calls? Depending on what you're doing with @timeArray and $ctime you will get inconsistent results. This could hurt. I have seen it happen.my $time = time; my $ctime = localtime; my @timeArray = localtime;
Have fun,
Carl Forde
|
|---|