Declaring numeric variables

In your Exercise Files folder, you'll notice a folder 03 Variables, and inside…of that folder, there is a file variables.pl. Go ahead and make a copy of that…now, so we don't write over the original.…We'll just call it numbers.pl.…Now, go ahead and open that, and there we have numbers.pl.…We're just going to start right here and start declaring some variables,…my $decimal = 12345;.…

So, what this does is it declares a variable called decimal, and because of the…dollar($) sign, this is a scalar variable, which means it's a one-dimensional…variable and assigns the value 12345 to it, which is a decimal number.…Now first of all, notice this my keyword, and what that does is it declares a…variable to have a lexical scope inside the block and which you have defined.…If you hover the mouse over here in Eclipse, you will get a little pop-up…definition and we see this definition: "A 'my' declares the listed variables to…be local (lexically) to the enclosing block, file, or 'veal'."…So, why this is important is because with strict and warnings invoked up here, if…

Resume Transcript Auto-Scroll

Author

Released

4/23/2010

In Perl 5 Essential Training, author Bill Weinman explains the fundamentals of programming in Perl, a flexible and powerful programming language that's well suited for projects as varied as simple scripts to complex web applications. This course covers the details of the language, from conditionals, loops, and data structures to regular expressions, functions, and object-oriented programming. A quick-start guide is included for experienced developers who want to get up and running with Perl 5 fast. Exercise files are included with the course.

Topics include:

Understanding Perl's general syntax

Using data types effectively

Defining and calling subroutines

Modular and object-oriented programming

Prefix and postfix loops and conditionals

Performing math, manipulating strings, and working with complex data structures