in reply to checking substring for numbers

Now the guys have explained why your code is failing, you might also consider using:

my $shop = m/.{8}(\d{4})/ ? $1 : '0000';

or if you have an aversion to the ternary operator

my $shop = '0000'; $shop = $1 if $AResp =~ /.{8}(\d{4})/;