The 1e6 seems like cheating, but I can't work out another algorithm. There should be one, according to a reference @ MathWorld, but the paper isn't online.
#!perl -l $_=1;for$i(2..pop){$_*=$i;s/0*$//;$_%=1e6}print$_%10