@a = qw/foo bar foo baz bar qux foo/; $hash{$_}++ foreach @a;