http://www.perlmonks.org?node_id=632035


in reply to Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

If you don't mind the different order of the output then:
$ perl -le'print for keys %{ { "ZBBBCZZ" =~ /((.)\2*)/g } }' Z ZZ BBB C
  :-)