I implemented your snippet in my XS and it worked properly. Then I started again to test why my code didn't work. It was simply a problem of declaration: if I declare the SV * zahl inside the if-else statement the compiler somehow doesn't get that the variable will be declared anyways and starts to throw a massive amount of errors at me. Your code did work because you avoided the declaration of this additional SV *. Somehow I feel quite dumb now. Thanks for the help, all!