I don't think it really had anything to do with Perl, but the accident of history that Perl became popular in the 1990s.
When the big Internet boom was going on, anyone with a pulse could get a job as a programmer (or a CEO, visionary, whatever). Perl, having a low initial learning curve, was used by a lot of people who didn't really know any more about programming than the very basic Perl they scrounged from examples. They didn't really care about quality or learning programming, but were hoping to cash out of some big internet success. It was the Wild West of programming, and there weren't enough experienced team leaders (if any in most places) to do anything about it. The code they pumped out was horrible, but everything lives forever on the internet. More people copied the crappy examples they saw. A lot of people relied on genetic programming accidently: cutting, pasting, and adjusting until things worked without understanding any of it.
And, at the start of the internet boom, there wasn't any software to do the sorts of things that people wanted to do on their web pages. If they found a script from some 15 year old, they just used it. They'd get some other kid to make some changes, and so on. I'm not making this up, and I'm thinking about very real people whom I won't shame publicly. That stuff got passed around liberally. People built entire business plans around 100 line Perl scripts that they found on the Net, didn't understand, and never intended to rewrite. Some of us have the scars for un-fubaring those situations when they hit the scalability wall (no, you can't have 40,000 subscribers and fork a process for each of them every five minutes).
Perl also has the benefit that it's partially designed to be very accessible. "Regular " people can get quite a bit done with just the stuff in Learning Perl, which is only the very basics and only about 400 pages. Since this part of the audience has very little background with programming, they often come up with interesting paths to their problems. They forget why they cobbled so much weird junk together, but they don't want to change any of it because they won't know how to fix it.
Mind you, this has nothing to do with smarts or intelligence. It's mostly just an experience problem. "Baby Perl" is very easy to use for the inexperienced, or "accidental" programmer. These people typically care more about other tasks than programming, so they don't really have iterative delvelopment and improvement. When they get close to a solution, no matter how ugly, they tend to stop. Unfortunately, that's a lot of the code that the public sees.
Ruby has the advantage of seeing its boom after the dot.bomb, and it started off with a community that mostly knew good programming techniques already and just wanted a better language. I don't think Ruby has had the same problems for that reason. People weren't rushing to mine the internet gold, so Ruby's progress and community evolution has been much more sane. It's not an accident that 37 Signals loves both Ruby and beautiful design. :)