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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.