in reply to Help with HoAoA

fetchrow_arrayref lists a caveat, its that it reuses the reference, so all your array refs are pointing to the same one, its common pitfall, see http://search.cpan.org/perldoc/DBI#fetchrow_arrayref

You want to use fetchrow_array and push ...\@array or store a copy with  push ... [ @$ref ]

Replies are listed 'Best First'.
Re^2: Help with HoAoA (fetchrow_arrayref reuse)
by OfficeLinebacker (Chaplain) on Jun 20, 2013 at 14:04 UTC
    Thank you. Very helpful.

    For the record, I fixed it with

    :
    while (my @row = $select_sth->fetchrow_array()) { #split on colon,space,or dash my @ticket_time = split /:|\s|-/, $row[1]; my ($Dd,$Dh,$Dm,$Ds) = Delta_DHMS($ticket_time[0],$ticket_time[1],$ticket_time[2],$ti +cket_time[3],$ticket_time[4],0, $now_time[0],$now_time[1],$now_time[2],$now_time[3] +,$now_time[4],0); #my ($Dd,$Dh,$Dm,$Ds) = Delta_DHMS(@ticket_time,0,@now_time,0); my $delta_hrs = $Dd * 24 + $Dh; if ( $row[8] eq 'High' && $delta_hrs >= $thresholds{'High'}){ push @{$notify{'High'}}, \@row; }elsif ( $row[8] eq 'Medium' && $delta_hrs >= $thresholds{'Medium' +}){ push @{$notify{'Medium'}}, \@row; }elsif( $row[8] eq 'Low' && $delta_hrs >= $thresholds{'Low'}){ push @{$notify{'Low'}}, \@row; } #debug/testing statement here. warn "Time elapsed for ticket $row[0] of priority $row[8] is $delt +a_hrs."; }