in reply to split questions

If I can add one more suggestion to the mix, it looks to me that a hash would be the best way to store your data. And you can populate a hash in one step using a hash slice.

my @fields = qw(code subcode ...); # List of fieldnames my %response; @response{@fields} = split /,/, $response, 39;

You can then access individual fields from the response using syntax like $response{code}, $response{subcode}, etc.

Of course, depending on how much you intend to reuse this piece of code, it might be worth going the whole way and creating a Response object.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg