Category Archives: Perl

Objective-C decisions vs Perl descisions

I’m comparing Objective-C decision making with our beloved Perl decision making. Objective-C supports the if, else, else if & switch. Lets write some Objective-C code and write the Perl in parallel. #import <Foundation/Foundation.h> int main (int argc, const char * … Continue reading

Posted in C, Perl | Tagged , , , , | Leave a comment

Perl FTP Recursive Binary Issue

Another day….. Today’s kick in the nether regions was using Net::FTP::Recursive  which was defaulting to ascii transfer mode when doing a bulk website transfer. The issue was not with the text (html type) files but with the images. I believe … Continue reading

Posted in FreeBSD Administration, Perl | Tagged , , | Leave a comment

FreeBSD Quotas – bulk updates (using Perl)

Another day, another 63 pence (according to xe.com), and another potentially mind numbing repetitive FreeBSD admin operation. Todays request was to increase all of the web quotas to 1GB on a web server which has variable quotas set on a … Continue reading

Posted in FreeBSD Administration, Perl | Tagged , , , , , | Leave a comment

Perl match in scalar and list context (regex)

Sometimes it takes a throw-away comment in a book for a whole stack of jumbled info to just slot into place. The ‘Sixth Sense’ is on the telly and my wife is asking why she ‘didn’t notice it’ (the fact … Continue reading

Posted in Perl | Tagged , , , | Leave a comment

Perl array remove duplicate values – Update

Great news! I used the function from yesterdays post in a production script today. the script searches a log file on a 60 min basis and grab usernames and passwords, removes the dupes and enters the usernames and passwords to … Continue reading

Posted in Perl | Tagged , | Leave a comment

Removing duplicates from a Perl array – really this time

My last post got a bit sidetracked and i didn’t do a simple removal of dupes from an array. As I said last time, hashes cannot have duplicate keys, so the easiest way to do this is to simply create … Continue reading

Posted in Perl | Tagged , , , , | Leave a comment

Perl and ‘uniq’ – de-duping arrays and other tricks

There comes a time when everybody needs to de-dupe an array, or just simulate the UNIX uniq command. Here at $dayjob, for example, we do quite a lot of UNIX shell commands to look up the number of times has … Continue reading

Posted in Perl | Tagged , , , , | Leave a comment

Perl DBI MySQL failover databases

Further to the last post on Eval, here is how we can try server A, then if it fails, use server B instead. The hub of the issue is ‘or die’ , ‘or warn’ and ‘or’. Here is my test … Continue reading

Posted in MySQL, Perl | Tagged , , | Leave a comment

Trapping Errors with Eval

The end game of this task is to modify some MySQL based logging so it will try to connect to a central logging server, and if that fails, log to the local server, the update the central server when it … Continue reading

Posted in Perl | Tagged , , | Leave a comment

Upgrading Perl 5.10 to 5.12 on FreeBSD

So a customer asked to use the latest version of Perl on one of our web servers. Its Running FreeBSD 8.0 with Apache2.2 and Perl 5.10. The FreeBSD ports collection does not upgrade 5.10 to 5.12 with a normal upgrade … Continue reading

Posted in FreeBSD Administration, Perl | Tagged , , | Leave a comment