in reply to Re: reading a JSON object
in thread reading a JSON object

How do I convert timestamps to numbers so I can subtract them without getting the following error message:

Argument "timestamp" isn't numeric in subtraction

Replies are listed 'Best First'.
Re^3: reading a JSON object
by choroba (Cardinal) on May 15, 2022 at 22:17 UTC
    The error message indicates you're using the string timestamp in subtraction.

    $ perl -wE 'say "timestamp" - 2' Argument "timestamp" isn't numeric in subtraction (-) at -e line 1. -2

    I don't see how the string can be meaningfully converted to a number. Please, show the code that demonstrates the problem. Are you using the string directly instead of using it as a hash key?

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^3: reading a JSON object
by Corion (Patriarch) on May 16, 2022 at 07:50 UTC

    Note that the first row in your array consists of the column names. Maybe you are not skipping that first row properly?

    Other than that, choroba's advice of showing the relevant code and data still applies.