CoderZone.org

 Category: Perl Code

Bookmark and Share

A One-liner To Get Module Version - Just a a quick way to get the version from a module.
Authorized Domain - Validates a domain name to prevent remote access. Prevents your forms from being submitted ...
Bad Word Filter - Check a string and filter out prohibited words. Good for forums, guestbooks, etc.
Basename And Dirname in Perl - These two Perl functions implement approximations of the UNIX utilities 'basenam...
Call subroutine and pass filehandle - Call a subroutine and pass a filehandle. Perl's typeglob comes to ...
Call subroutine and pass variable by value - Call a subroutine and pass a variable by value.
Capitalize The First Word In A Sentence - The following Perl snippet will capitalize the first word in a sentence.
Check email address - Check an email address for validity.
Check For A Valid Email Address - This function will check whether or not an email address is validly formatted.
Check If A Directory Allows File Creation - Use the following snippet to try and create a test file. If success...
Convert Extensions To Lowercase - Searches for files having uppercase extensions and converts them to lowercase.
Convert Unix time string to a date/time group - Handy snippet that converts a Unix timestamp to a date/time group.
Copy Files By Date Modified - An easy way to copy files based on their last-modified date.
Copying and Substituting Simultaneously - Search and replace a copy of the string and in one step.
Count all words in a string - This search pattern will match what is generally considered to be a "word". We c...
Count specific characters in a string - If you just need a count of characters in a string, use the built-in fu...
Count words or terms - Count the number of times a given word or character appears in a string.
Create an array from a range of letters or numbers - The range operator ("..") expands two letter or number val...
Create an array from comma separated items in a string - The quotewords() function ignores separator characters...
Create an array from the contents of a directory - The function readdir returns a list of the names of each fil...
Create an array from the lines of a text file - The record input ("") operator reads in one record at a time fr...
Create string by formatting an amount as money - This uses Tan D Nguyen's module "Locale-Currency-Format".
Distance Calculation using Latitude and Longitude in Perl - Use this routine to calculate the distance between ...
Extract Just The BODY Of An HTML File - Extract just the BODY of an HTML file
Find Symlink Targets - Find all the files in a tree that have symlinks pointing to them, list the files, each f...
Generate unique strings of random numbers - This code snippet will produce strings of numbers (1 thru 49) with...
Get A Directory Listing Of Specific File Types - The following snippet puts a list of file names from the curre...
Get Date 30 days ago - The easy way to get the date 30 days ago- or any number of days, for that matter. Thi...
Get every 2nd (or 3rd, 4th, ...) element of an array - This snippet gets the 'xth' elements of an array. In thi...
Get File Size Over HTTP - This snippet uses LWP::UserAgent to retrieve info about a remotely hosted file over HTTP.

© coderzone.org | users online: 27