In the last article, you learned how to install Perl. It wouldn't make a lot of sense to install it on your computer if you never did anything with it, now would it? In this article, you'll take your first steps to becoming part of a wild and crazy breed -- a Perl programmer.
Originally written as a way to make writing reports simpler, Perl has evolved to include web development, server scripts, and system administration. Some would say it has devolved into some other zany uses as well, like Perl Golf, a game programmers play to try and use the least amount of code possible to program specific challenges. There is also Perl Poetry, for all you wanna-be Shakespeare's and Edgar Allen TyPoes (haha wordplay!).
Large websites such as Amazon, Ticketmaster, and IMDB.com use Perl. And in addition, you can use it to create graphical user interfaces.
So grab a candle and a crow's quill, and some ink. And get ready to learn Perl the poetic way.
(Note: I just read a poem in Perl that took the Billy Joel Song, "Uptown Girl" and made it "Uptown Perl").
A Data Type by Any Other Name Would Still Hold Data
Most programming languages are a real pain in the butt; they are nit-picky and like to play things by the book. Not Perl. Perl likes to sit around in its underwear drinking cans of Mountain Dew and making pyramids out of it. It likes to not take a shower for three days and eat a cold slice of that pizza it ordered a week ago and forgot to put in the fridge.
In your average programming language, you have to define the type of data you are using. Not so in Perl. Perl doesn't care. It takes what it can get. In Perl, data types, or structures, are built off of the first data type: Scalar.
Scalar Data Types
A scalar, in simple terms, is a single piece of data. It could be a number, a letter, a novel, you name it. But it can only be that one thing. It's like a folder you create on your desktop. You give it a name and throw some data into it. Done.
For now, we'll refer to that Folder as a variable. A variable holds data that you designate (or the user designates) that can be changed at a later data (hence the name variable). To let Perl know you are designating a variable as a scalar data type, you must place the $ in front of its name. You can choose to name your variable whatever you like, so long as it consists of only letters, numbers, and underscores. You may not begin the name with a number, however numbers can appear in the name. To keep things uniform, I would use all lowercase letters, and separate words by using our friend the underscore.