in reply to Re: Re: epoch time conversion
in thread epoch time conversion

Strange. It works perfectly on my system?

If your using a *nix system, you may need to swap every occurance of the " char for a ' and vice versa. That's the only thing that comes to mind.

If that doesn't work maybe one of the *nix guys hereabouts will help you further.

By way of proof that I did test this, here is a snippet of output from my screen.

C:\test>perl -F, -ane "local $,=','; print scalar localtime($F[0]), @F +[1..$#F] " <junk.dat Tue Dec 10 19:14:54 2002,some, random, garbage, Tue Dec 10 19:14:57 2002,some, random, garbage, Tue Dec 10 19:15:00 2002,some, random, garbage, Tue Dec 10 19:15:04 2002,some, random, garbage, Tue Dec 10 19:15:07 2002,some, random, garbage, Tue Dec 10 19:15:09 2002,some, random, garbage, Tue Dec 10 19:15:11 2002,some, random, garbage, Tue Dec 10 19:15:13 2002,some, random, garbage, Tue Dec 10 19:15:14 2002,some, random, garbage,

Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.

Replies are listed 'Best First'.
Re: Re: Re: Re: epoch time conversion
by tall_man (Parson) on Dec 10, 2002 at 21:38 UTC
    If your using a *nix system, you may need to swap every occurance of the " char for a ' and vice versa. That's the only thing that comes to mind.

    There's one more thing. Since there's a quoted comma in there, you should use the q() style to quote it. Update: Swapping all " for ' also works, of course, but I always use "q" and "qq" for single-line scripts like this for clarity.

    perl -F, -ane 'local $,=q(,); print scalar localtime($F[0]), @F[1..$#F +] ' <junk.dat

      It certainly wouldn't harm, though I only used single quotes because I can get away with them inside the doubles.

      Switching them to doubles and the outer quotes to singles still works in this case.


      Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
      Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
      Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
      Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.

Re: Re: Re: Re: epoch time conversion
by ordimus (Initiate) on Dec 10, 2002 at 21:30 UTC
    thanks much...that did it