Uri Guttman <[email protected]> writes:
> whenever i print stuff for debugging i put it in [] or similar so i can
> see
> white space or other odd things.
>
>
> try print "[$obtime[1]]" and see what is really there.
DB<2> print "[$obtime[1]]"
[ 31 Oct 2018 06:53:00 -0500]
I do believe that the leading white space before the 3 should not
be there.
#get rid of leading spaces.
$obtime[1] =~ s/^\s+//;
#get rid of trailing spaces.
$obtime[1] =~ s/\s+$//;
DB<2> print "[$obtime[1]]"
[31 Oct 2018 06:53:00 -0500]
One of the oldest admonitions in the book says "Never trust data."
That leading space came from the split of a , separated
string and it completely got by me.
I'd like to say that it's working but not yet. There seems to be
nothing wrong with the string now.
my $t1 = Time::Piece->strptime("$obtime[1], %d %b %Y %H:%M:%S %z");
Still the parse error.
Right now, I do have both
use Time::Local;
use Time::Piece;
in the program and Time::Piece is supposed to replace many of the
functions of Time::Local. If I comment out Time::Local, a
reference to gntime breaks.
Could this be causing Time::Piece not to work?
Martin McCormick
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/