Hi,

I'm comparing an array of email addresses with another array of emails with appended dates. I want to remove the dates, reformat them, sort them most recent first.

The script worked but ended before it worked through the entire array. I thought it timed out for some reason and fed the script a shorter array.Again it worked before completing the array. Again I shortened it and then it failed to work at all displaying the error: Error parsing time at /usr/lib64/perl5/Time/Piece.pm line 469.

#!/usr/bin/perl -wt use strict; use CGI ':standard'; use CGI::Carp qw(fatalsToBrowser); use Time::Piece; print "Content-type: text/html\n\n"; my (@buyers,@csv,@dif,@end,@sort,@time,@zed,$demo,$first,$second); open (CSV,"<../../public_html/emails.txt"); @csv=<CSV>; close (CSV); open (BUYERS,"<../../public_html/buyers.txt"); @buyers=<BUYERS>; close (BUYERS); foreach $first(@csv) { chomp($first); push(@zed,$first); foreach $_(@buyers) { if($_=~/$first/) { $_=~/\d+\/\d+\/\d+/; my $date=Time::Piece->strptime($&, '%m/%d/%Y'); my $newdate=$date->strftime('%Y%m%d'); push(@time, $newdate); } } @time = sort {$b <=> $a} @time; foreach (@time) { push(@zed,$_ ); } undef(@time); }

I can't determine what is generating the error. Thanks in advance.


In reply to time::piece Error parsing time at /usr/lib64/perl5/Time/Piece.pm line 469 by darkwell

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.