After abigail's post, it's clear how $# works. Perl calls the builtin sprintf with a single floating point argument, and the resulting text is
the string representation of the number (if $# is set). You can even decompose a double to two ints by setting $# to "%x/%x".
This explains the strange strange phenomena that setting $# to a stupid value causes.
However, as an interesting consequence you can still segfault perl with some code like
perl -we '$#="%s\n"; print exp 1;' or perl -we '$#="%n\n"; print exp 1;'