darkwell has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: time::piece Error parsing time at /usr/lib64/perl5/Time/Piece.pm line 469
by poj (Abbot) on Mar 06, 2018 at 08:21 UTC | |
by choroba (Cardinal) on Mar 06, 2018 at 09:16 UTC | |
by darkwell (Initiate) on Mar 07, 2018 at 01:02 UTC | |
by hippo (Archbishop) on Mar 07, 2018 at 09:01 UTC | |
by poj (Abbot) on Mar 07, 2018 at 11:04 UTC | |
|
Re: time::piece Error parsing time at /usr/lib64/perl5/Time/Piece.pm line 469
by Anonymous Monk on Mar 06, 2018 at 06:25 UTC |