Perl's a maintenance horror.
Java, less so.
If I save £20K on hardware but burn through an additional £50K in software maintenance (easily done), I'm £30K down; for all but the most performance-critical applications, no one upstairs is going to care that it's OMG FAST!!, they're just going to extract my gonads for overspending.
My experience is that, for a bespoke system with (say) a five year lifespan with software maintenance (not just bugfixes, but features and stuff) included, hardware is 10% or thereabouts of the total cost.