"The optimal control of infinitesimal flow disturbances experiencing the largest transient gain over a fixed time span, commonly termed ""optimal perturbations,"" is undertaken using a variational technique in two- and three-dimensional boundary layer flows. The cost function employed includes various energy metrics which can be weighted according to their perceived importance, simplifying the task of determining which terms are essential for a ""good"" control scheme. In the accelerated boundary layers investigated, disturbance kinetic energy can be typically reduced by about one order of magnitude. However, it seems impossible to suppress perturbations completely over the entire control interval; ""good"" control strategies still permit approximately an order of magnitude growth over the initial energy at some point in the interval. It is shown that the control effort efficiently targets the physical mechanisms behind transient growth."