in reply to Perl Switch Errors on certain version

Scarey having to deal with all of those numbers! I trust that they are coming from data or an external program and not being generated elsewhere in the script, as they are a debugging unfriendly way to pass information!

I second getting rid of the switch($subkey)

There's no harm in using:

if ( $subkey eq 1 ) { ... } elsif ( $subkey eq 11 ) { ... } ...
Also, in the 150 block where you have:
elsif($new1 == /1/){
down to:
elsif($new1 == /9/){
What are you expecting the string to be and what trying to test? ... a text match anywhere on the string:
elsif($new1 =~ /1/){
or a test for the actual exact number?
elsif($new1 eq 1){
or something else? I did this test myself how it would act:
#!/usr/bin/perl -w use strict; for my $new1 qw(1 11 a1a 1aa 001 010) { print "$new1 == /1/ : "; if ( $new1 == /1/ ) { print "YES\n"; } else { print "NO\n"; } print "-" x 10, $/; print "$new1 == 1 : "; if ( $new1 == 1 ) { print "YES\n"; } else { print "NO\n"; } print "-" x 10, $/; print "$new1 =~ /1/ : "; if ( $new1 =~ /1/ ) { print "YES\n"; } else { print "NO\n"; } print "-" x 10, $/; print "$new1 eq /1/ : "; if ( $new1 eq /1/ ) { print "YES\n"; } else { print "NO\n"; } print "-" x 10, $/; print "$new1 eq 1 : "; if ( $new1 eq 1 ) { print "YES\n"; } else { print "NO\n"; } print "=" x 10, $/; }
and was quite surprised by the results!
if ( $new1 == /1/ )
actually fails with:
Use of uninitialized value in pattern match (m//) at ./try.pl line 8.
if $new1 *is* 1 but on the other hand SUCCEEDS if $new1 is "a1a" !!!