Dr. Robert Kline, of West Chester University, has created a very handy two-column, single-page comparison of Perl and PHP, ideal for those of you that need to convert some code. Not only does he give you simple coding examples for both languages, he also shows how to use mySQL in both languages.
Nice work, Dr. Kline. […]
If you’ve read any of my first five Perl tutorials, you’ll know that Randal Schwartz graced the comments. For anyone familiar with Perl, you know that Randal is considered a god amongst Perl programmers, having worked with the language from its inception, and having written tons of books and articles about Perl, either in whole […]
03 Mar
Posted by rdash as Perl tips, Programming, Regular expressions, Regexes
This tutorial is based on the last one. We read in a file and print out each line of data with a line number. However, this time, if a line is blank or contains only white space, we remove it. To show that the script works, the line numbering in the output will match that […]
28 Feb
Posted by rdash as Perl tips, Programming
This tutorial is a variation of the last one. As before, we read in lines of a data file and print them out with line numbers. The difference is that in this version, we specify the filename in the commandline parameters instead of redirecting standard input. (Feel free to compare the output of this script […]
28 Feb
Posted by rdash as Perl tips, Programming
Reading all the lines of a data file is a very basic operation. Perl lets you do this in a number of ways. The method of feeding the data file to the Perl program can either be a redirect from the command line, or through a specified filename:
> perl readfile.pl < inputfile.txt
> perl readfile.pl inputfile.txt
This […]
26 Feb
Posted by rdash as Perl tips, Programming
One of the strengths of Perl is that data types are very loose, and can change form. Thus programming variables can hold more than one type and shape of data, including numbers or strings. If you write prototype code to test out ideas, you can often temporarily assume that your input data is of the […]
26 Feb
Posted by rdash as Perl tips, Programming, Parameters
Most Perl books start with a “Hello, World” tutorial. That’s probably the simplest example to start with for most programming languages. But finding out how many parameters are in the commandline to a Perl script is also simple, and very important to most of the tutorials on this site.
I should note beforehand that some Perl […]
These are the assumptions for the Perl-Tips category:
Some operating systems that run Perl treat the name of the perl program as a parameter. If you use the Perl code presented on this site, you’ll be able to see what your system thinks the commandline parameters are. I’m assuming, in all my tutorials, that you are […]
As most Perl programmers are wont to say, there’s always more than one way. Perl’s rich feature set allows you to do the same thing using different techniques. When I first started using Perl over 10 years ago, I used it like a C programmer. As I became more comfortable with it, my Perl code […]
A very common Perl tenet is that there is always more than one way to perform the same functionality. I won’t necessarily provide you the most efficient way, just the easiest to understand and/or explain. I could write entirely cryptic but tiny code snippets, but if I can’t explain it, or you can’t understand it, […]
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Nov | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||