There is also the fact that single quotes produce literally what is there rather than translating $variables. The example with sub has used double quotes whereas the OP didn't. So instead of using sub, it so happens you could also achieve the delay by keeping the single quotes and putting an eval around what is being printed and of course it makes me wonder if the OP code originated in or was copied from that kind of example somewhere.
in reply to Using pattern match
^M Free your mind!