I may have misunderstood your message. Only use the last statement if you wish to exit the loop.Otherwise ikegami has the correct code/solution.
apologies for any confusion
s;;5776?12321=10609$d=9409:12100$xx;;s;(\d*);push @_,$1;eg;map{print chr(sqrt($_))."\n"} @_;