in reply to split questions

Like everyone else I'd advise an array rather than individually names scalars. I add the twist of using constants to give the individual elements of that array meaningful names.

use constant CODE=>0; use constant SUBCODE=>1; ...

If your using 5.8 then your can combine the constant declarations into one

use constant { CODE=>0, SUBCODE=>1, .... };

Your code can then read something like this

if( $response[CODE] == 20 and $response[SUBCODE] == 55 ) { # Do something appropriate }

Which is nicely self-documenting and efficient to boot.

If your application lends itself to it, then the above test could become

if( "@response[CODE, SUBCODE]" eq '20 55' ) { # do stuff }

which can greatly simplify and clarify coumpound conditionals provided the individual elements don't contain spaces.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller