1) Bad code is in the eye of the beholder.
2) Who among us hasn't written bad code?
]]>To Cladi.it, I hope you're not too discouraged and still doing Perl wherever you are right now. It's a fun and great language. And in fact, the community is much better now than it used to be, despite your particular experience here. Trust me.
]]>In short: never, never, never break production by accident. You break it very deliberately when you *know* that you have no choice but to break it.
]]>
use Regexp::Assemble;
my $regex = Regexp::Assemble->new->add(@patterns)->ra;
... at the top of Aaron's (most excellent) suggestion. Although while on 5.8 this will be much faster, from 5.10 onwards it will be slower, so not much win. It would be much more so if the patterns were regular expressions themselves.
]]>Cheers!
]]>my $query = <<"END_SQL";
SELECT foo, bar, baz
FROM SomeTable
WHERE id = ANY(?)
END_SQL
And then pass an array reference as the value. \o/
]]>But Abigail's example wouldn't make it past review onto a production server. I'm on a multi-decade project and there's an inevitable turnover of staff so maintainability of code is critical; moreso even than having it work properly (maintainable but faulty code is fixable; working but unmaintainable code that needs updating is useless). Other people who are new to my code (and that really includes me more than a couple of weeks after writing it :/ ) must be able to maintain it as easily as possible. It is increasingly difficult to find experienced perl devs and much of the resistance from others comes from all that "perl is line-noise" nonsense. I think it behooves us to write perl that is not line-noise, and is as far from it as is reasonable.
*frowns at Liz* :)
]]>