As pointed out above, you are passing (the address off) an abritrary lump of string data to the OS kernel and asking it to call this as a function when your process receives a signal. Needless to say, when the OS tries to execute the machine code located at that location, the text "&catch" doesn't translate well into x86 machine code.

Even if you correctly pass the address of your catch subroutine to the OS, it still isn't going to work. The code pointed at by &catch is perl bytecode, not x86 machinecode.

I have no idea whether this would work is conjunction with SetConsoleCtrlHandler, but it's possible. I think that you may well be the first to try to do this, which means you will be on your own for the most part.

The alternative is to write your own callback wrapper in C or XS. You will need a compiler compatible with the build of Perl you are using. Again, you will be very much on your own getting this to work.

I would guess that my $func = "\&catch"; should really read my $func = \&catch; as you probably want a reference to a function and not the function name as a string.
This is just a quick thought, though.
Hope this helped.CombatSquirrel.
Entropy is the tendency of everything going to hell.