Simple but useful Perl Scripts that can be used to make your web site smart.
| Print Environment | printenv.pl | Simple but very handy when starting to work on a new machine | try it |
| View an ASCII (flat) file | showlog.pl | Simply read a file and display it in html using the <PRE>tag | try it, you should see your IP address at the end of the log. |
Send email(unix/linux) when home page is accessed | mailme.pl | log and email home page hits, or any page access | can't try this one, security issue |
| Save and load a hash/associative array to/from disk |
saveHash loadHash CGI program |
simple way to save HTML form data to disk or save user data from form to form (session persistance) This simple set of files tryRWhash.htm,save2disk.pl rwhash.pl pull CGI, html forms, and persistance together. |
try it |
| Append debug or tracking data to a flat file | logit.pl trylogit.pl |
Very simple but powerful debugging, tracing, monitoring subroutine |
try it |
| How and how not to use my to make subroutines local (local scope). |
local_variables_my.pl | Scope issues, using my to make subroutine variables local |
try it, see output of various examples below the horizontal rule |
| Convert comma separated file ( csv ) to tab separated. |
csv.pl | Uses command line option argv[0] as input file Uses argv[1] is output file name |
command line example: csv.pl data.csv newdata.tab |
| Truncate trailing spaces | trailspaces.pl | Simple but effective use of search and replace | ![]() |
| Trim a log file | trimLog.pl | Trim off old part of an ASCII log file. Create sequentially named archives of trimmed data. | Trim 8 meg from a 10 meg file![]() |
| Get IP addresses of running Windows computers |
getIP.pl | Using output from "net view" ping all systems and make a comma separated list of system names and IP addresses. | resulting output![]() |
| Build HTML table from a tab seperated input file. |
maketab.pl | Put unique sorted column data into HTML table by column instead of by row. | ![]() |