How To Round Up A Number In Perl

Author: , October 10th, 2011

To round up to the nearest 5:

http://search.cpan.org/dist/Math-Round/Round.pm To round up to the nearest 1: Cross-posted from PerlMonks:

How To Enable A Repo Using Perl

Author: , September 4th, 2011

Normally, I have to specify the desired repo on the command line: yum –enablerepo=remi,remi-test install {package name here} To enable the Remi repo so you do not have to specify it on the command line: # perl -pi -e ‘s/enabled=0/enabled=1/g’ /etc/yum.repos.d/remi.repo To disable the Remi repo so you do not have to specify it on […]

How To Pass Hashes As Subroutine Arguments In Perl

Author: , August 19th, 2011

A small step forwards in understanding how Perl handles hashes as arguments. This biggest difference is that the first way “slurps” in ALL passed values in @_ into the %args hash. The second (cooler) way, pulls in the arguments hash as a single scalar variable, allowing multiple variables to be passed via @_, if you […]

How To Load An XML File Into MySQL Using Perl

Author: , August 3rd, 2011

How To Trim Whitespace Using Perl

Author: , August 3rd, 2011

How To Obtain The Current Year In Perl Easily

Author: , June 29th, 2011

This simple formula will give a Y2K-compliant 4-digit year with low overhead:

How To Declare DOCTYPE And Encoding Using CGI.pm And PERL

Author: , May 31st, 2011

I found myself needing a specific doctype the other day and this is what I found… First, get the correct doctype string from the W3C website list. Then, simply use -dtd to specify it to CGI.pm during the call to start_html:

In addition, use -encoding to specify the character set for XHTML. It defaults […]

How To Get Last Day Of Current Month With Suffix Using PERL

Author: , May 28th, 2011

How To Use Tie::IxHash With Anonymous Hash Variables In Perl

Author: , May 18th, 2011

Tie:IxHash CPAN Manual Page

How To Loop Through Objects In JavaScript

Author: , May 15th, 2011

Coming from the Perl world, I wanted to emulate the following code in JavaScript:

What I found is that JavaScript uses “Objects” to contain hash-style data:

Also, one may use variables as key names by using the square-bracket notation, which evaluates variables first: