http://www.perlmonks.org?node_id=176873


in reply to factorialmath.

Since this clearly isn't homework (cough), here's an idea of how to solve the problem:
#!/usr/bin/perl package F;sub TIESCALAR{bless[],pop} sub FETCH{$v=$n=pop()->[$|];$v*=--$n while(1<$n);$v}sub STORE{shift()->[0 ]=pop}tie($f,F);$f=pop;print$f,$/,$@