My eyes do not see lexical variables. Are the (presumably global) p3_ variables being re-used somewhere else later in the script, where their values cause the script to barf? Try putting use CGI::Carp 'fatalsToBrowser';, at the top of your CGI script and you may get something more helpful than a bald 500 server error.
Re: Split into @array works, into ($val1, $val2, ...) doesn't.
Select or Download Code Replies are listed 'Best First'.