Seeing the answer without knowing the question was bugging me.
There are always several ways to do something in Perl (using grep instead of the smart matching operator, for example).
Something similar to the example provided would be less error prone, especially if you ever intend to change the items that are required.