Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Diff'ing dates

by LighthouseJ (Sexton)
on Oct 02, 2007 at 14:19 UTC ( [id://642115]=note: print w/replies, xml ) Need Help??


in reply to Re: Diff'ing dates
in thread Diff'ing dates (solved)

I tried the command and this is what I got:
$ echo -e "Sun 09 30 06 42 36 2007\nTue 10 02 06 01 55 2007\n" | perl +-MTime::Local -lane"END{print$t}$F[1]--;$t+=($.*2-3)*timelocal@F[5,4, +3,2,1,6]" Can't modify single ref constructor in postdecrement (--) at -e line 1 +, near "]--" syntax error at -e line 1, near "+=" Execution of -e aborted due to compilation errors.
"The three principal virtues of a programmer are Laziness, Impatience, and Hubris. See the Camel Book for why." -- `man perl`

Replies are listed 'Best First'.
Re^3: Diff'ing dates
by shmem (Chancellor) on Oct 02, 2007 at 14:47 UTC
    Use single quotes on UNIX-like operating systems:
    echo -e "Sun 09 30 06 42 36 2007\nTue 10 02 06 01 55 2007\n" | \ perl -MTime::Local -lane 'END{print$t}$F[1]--;$t+=($.*2-3)*timelocal@F +[5,4,3,2,1,6]'

    Double quotes cause your shell to interpret e.g. $t as a shell variable.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re^3: Diff'ing dates
by ikegami (Patriarch) on Oct 02, 2007 at 14:43 UTC
    Use the appropriate quotes for your shell. Switch double quotes for single quotes.
      I figured you had written the one-liner with single quotes anyway. The small monospace text perlmonks use looked like single quotes because I knew I didn't want to interpolate any variables.
      "The three principal virtues of a programmer are Laziness, Impatience, and Hubris. See the Camel Book for why." -- `man perl`

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://642115]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2025-05-14 05:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.