In a large pot of boiling salted water, cook the green beans until tender, about 5 minutes. Drain well.
Melt the butter in a large skillet. Add the onion and cook over moderate heat until softened, 5 minutes. Add the anchovies and capers; cook for 1 minute, stirring. Add the beans, season with pepper and cook for 2 minutes, stirring occasionally. Serve at once.