Category Archives: Programming Languages

Blogs about programming languages (Java, PHP, Ruby, etc.).

Perl – Using Pattern-sequence Memory with Regular Expressions

Pattern-sequence memory is very useful when you want to match the same character in several places but don’t care which character you match as long as all occurrences are the same character. For example, the below code matches the date … Continue reading

Posted in Perl, Programming Languages, Technology | Tagged , , , , , , , , , | Leave a comment

Perl – Obtain the File Size

Here is a cool one line Perl script you can use to quickly obtain the file size of a file. The syntax to run the script is “perl [scriptname] [filename]”; in the below example I use the script itself as … Continue reading

Posted in Perl, Programming Languages, Technology | Tagged , , , , , , | Leave a comment

Perl – Writing the Linux ‘cat’ Utility

The below Perl code will give you similar results compared to the Linux ‘cat’ utility. At the command prompt, just enter “perl [scriptname] [filename1] [filename2] etc …

Posted in Perl, Programming Languages, Technology | Tagged , , , , , , | Leave a comment

Perl – File-Test Operators

In Perl, file-test operators are useful for determining the status of a file. Some of the operators below refer to the “real user” which is the User ID specified at login rather than “effectve User ID” which refers to the … Continue reading

Posted in Perl, Programming Languages, Technology | Tagged , , , , , , , , | Leave a comment

Perl – Converting the Time from 24 hr to 12 hr Format

Below is a Perl script that demonstrates how to appropriately convert the current time from 24 hr format to 12 hr format. The ‘convertToTwelveHr’ subroutine does all the work here. The 24 hr input value is passed into the subroutine … Continue reading

Posted in Perl, Programming Languages, Technology | Tagged , , , , , , , , , | Leave a comment

Perl – merging files

Below I demonstrate a quick method of merging two files into a third file using Perl. The program merges two files together into a third file by writing one line from file one to file three and then writing one … Continue reading

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

Perl – Initial Values and Context Based Evaluation

It’s important to remember that in Perl all scalar variables have an initial value of the null string, “”. You do not need to define a value for scalar variables unless you are using “strict” mode. Knowing this, what do … Continue reading

Posted in Perl, Programming Languages, Technology | Tagged , , , , , , , | Leave a comment

Screen Scraping with Perl to get the top 25 Websites and the Web Servers they use

This was a really fun little script I wrote that I thought I would share with everyone. I basically wrote a Perl script using the popular LWP Perl module to screen scrape and obtain the top 25 sites and the … Continue reading

Posted in Data Mining, Hacks, Perl, Programming Languages, Technology | Tagged , , , , , , , , , , , , , , , , , , , , , , , , | 3 Comments

VMware VI SDK – guestOsId values (VirtualMachineGuestOsIdentifier)

I was creating some Virtual Machines using the Java VI SDK and needed the respective values for the VirtualMachineGuestOsIdentifier (abbreviated by many as guestOsId). I realized many people are searching for this information but have trouble locating it simply because … Continue reading

Posted in Java, Programming Languages, Virtualization and Cloud Computing | Tagged , , , , , , , , , , | Leave a comment

Perl – Get files and directories with the glob function

Recently, as part of a larger Perl application, I had to get all the files and sub-directories of the working directory. Using the built-in ‘glob’ function, I was able to quickly implement a subroutine to do this and also differentiate … Continue reading

Posted in Perl, Programming Languages | Tagged , , , , , , , | 3 Comments