All the above work, some more some less.
Also try hitting the local yard sales and buying up old bottles of perfume, stinier the better. Hang scraps of clothe on the peremiter. Works some places others it don't.
A while back I had troubles with crows gettin' the sweet corn so I shot one and hung it up I the center of the corn patch. Worked quite well til a bear walked off with the carcass....
I use the electric fence method referenced by others. I use the ribbon "wire". One at 3 inches keeps the raccoon out and one at 30 inches for the deer. Been doing this for about 8 years and haven't lost a thing since.