CSIS054: Perl ProgrammingQuestions for week 3
|
|
QUESTION | ANSWER (highlight to read) |
What does this code do: $a = <STDIN>; |
read text input from the user, put it into variable $a. |
How do I make a comment in a script? | With a hash sign (#). |
What is a boolean? | A value of true or false. |
What are the other types of variables in perl? | scalar, list, hash. |
What kinds of values can a scalar variable hold? | character, string, integer, float, boolean, or undefined. |
What are the boolean operators? (all 9 of them) | >, <, >=, <=, ==, eq, and, or, not. |
What are the operators for modulo (remainder after division) and exponent? | % and ^. |
What is the syntax for an if statement? | if (CONDITION) { # STATEMENTS } |
What is the syntax for an if/else statement? | if (CONDITION) { # STATEMENTS } else { # OTHER STATEMENTS } |
What is the syntax for a while loop? | while (CONDITION) { # STATEMENTS } |
What happens to the value of a variable when I assign a new value to it? | It's gone forever. |
What happens to the value of all the variables when a script is finished running? | They are gone forever. |
Address of this page is http://hhh.gavilan.edu/phowell/csis054/03questions.html
Please contact Peter Howell at phowell@gavilan.edu for questions or comments.
Last updated January 10, 2010.