Most of the ugly code can be avoided nowadays.. but for special cases (as that one) and a few not-so-special cases, the code can get ugly. At least until you get used to it ;)
Also, perl is very flexible which is a good thing. But for better or for worse, perl lets people do crazy things.
Actually, that flexibility is one great things about perl. If you know what you are doing, you can adapt the style for the purpose. For example, hack together something fast, and if it looks like a viable solution, flesh it out into something more maintainable. This is true for other languages as well, but IMHO, even more so for perl.
When ever I hear people sing the praises of perl it just always make me think most haven't really sat down and learn many other languages. It's like hearing an English speaker say something like "man, English is so great because you can... like, express yourself in it! And there are even lots of ways to express yourself in it! And you can express all kinds of stuff!". Great, so it's like all the other languages then?
Actually, that flexibility is one great things about perl. If you know what you are doing, you can adapt the style for the purpose. For example, hack together something fast, and if it looks like a viable solution, flesh it out into something more maintainable. This is true for other languages as well, but IMHO, even more so for perl.