Update infect.pl

Moved direction picking into a function