in reply to Error: Uninicialized Value

Look at your output.

3104|1|New Years|12/31/2007 3104|1|Holiday|1/1/2008 3104|1|Clinic|1/2/2008 3104|1||1/3/2008 ^^---- the uninitialized value is here

You do

print "$PID|$SID|",shift(@flds),"|$date\n";

but sometimes the value shifted off @flds is undef. Quick fix:

print "$PID|$SID|",(@flds ? shift(@flds) : ''),"|$date\n";

But if those output lines containing an empty 3rd field are unwanted anyways, say

print "$PID|$SID|",shift(@flds),"|$date\n" if $flds[0];

Why are you

my @dates_copy = @dates;

copying @dates each pass through the loop? Just iterate over @dates.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}