Wednesday, November 4, 2015

Test Exercise 2 : Comments

# Exercise 2 : Comments

Comments are very important in your programs. They are used to tell you what something does in English, and they are used to disable parts of your program if you need to remove them temporarily. Here's how you use comments in Perl:

`# A`
`print "hi";`

```
`# A comment, this is so you can read your program later.`
`# Anything after the # is ignored by python.

print "I could have code like this." # and the comment after is ignored

`# You can also use a comment to "disable" or comment out a piece of code:`
`# print "This won't run."

print "This will run."
```

From now on, I'm going to write code like this. It is important for you to understand that everything does not have to be literal. Your screen and program may visually look different, but what's important is the text you type into the file you're writing in your text editor. In fact, I could work with any text editor and the results would be the same.

# What You Should See

```
I could have code like this.
This will run.
```

Monday, November 2, 2015

Exercise 5 : More Variables And Printing

Exercise 5 : More Variables And Printing

$book_name = 'Learn Perl The Hard Way';
$book_pages = 5;

print $book_name, " is ", $book_pages, " pages.";

Exercise 4 : Variables And Names

Exercise 4 : Variables And Names

$cars = 10;
print $cars;

Exercise 3 : Numbers And Math

Exercise 3 : Numbers And Math

print 3+5;
print "\n";
print 3-5;

Exercise 2 : Comments

Exercise 2 : Comments

Comments are very important in your programs. They are used to tell you what something does in English, and they are used to disable parts of your program if you need to remove them temporarily.  Here's how you use comments in Perl:

Comments are very important in your programs. They are used to tell you what something does in English, and they are used to disable parts of your program if you need to remove them temporarily. Here's how you use comments in Perl:
# A comment, this is so you can read your program later.
# Anything after the # is ignored by python.

print "I could have code like this."; # and the comment after is ignored

# You can also use a comment to "disable" or comment out a piece of code:
# print "This won't run."

print "This will run.";
From now on, I'm going to write code like this. It is important for you to understand that everything does not have to be literal. Your screen and program may visually look different, but what's important is the text you type into the file you're writing in your text editor. In fact, I could work with any text editor and the results would be the same.

What You Should See

I could have code like this.
This will run.

Study Drills

Common Student Questions


Exercise 1 : A Good First Program

Exercise 1 : A Good First Program

print "Hello World !"
print 'Hi Perl !'

Exercise 0 : The Setup

Exercise 0 : The Setup

Visit http://codepad.org/

Table Of Contents



Exercise 1 : A Good First Program  [ Japan logdown link  ]
Exercise 2 : Comments [ logdown link ]
Exercise 3 : Numbers And Math

Learn Perl The Hard Way ( Zed Shaw , Frank Wu ) 2015

Try It For Free