Home > Articles > Web Development > Perl

  • Print
  • + Share This
This chapter is from the book



  1. 1. Variables are interpolated inside qq quotes.

    1. True

    2. False

  2. What value is stored in $c after running the following code?

  3. $a=6;
    1. 6

    2. 7

    3. 8

  4. Concatenation can be performed only with the concatenation operator (.).
    1. True

    2. False


  1. a. True. qq behaves in every way like a pair of double quotation marks. This means it can interpolate variables.

  2. a. $a is set to 6. $a is then incremented to 7, and assigned to $b. $b is decremented to 6, and assigned to $c.

  3. b. False. A motto in the Perl community is "There Is More Than One Way To Do It" (TIMTOWTDI). Concatenation can be performed by including two (or more) scalars in a double-quoted string, as follows:

  4. qq($a$b$c);


  • Write a short program that prompts the user for a Fahrenheit temperature and prints the temperature in Celsius. Converting Fahrenheit temperature to Celsius can be accomplished by taking the Fahrenheit temperature and subtracting 32, and then multiplying by 5/9. For example, 75 degrees Fahrenheit is 23.8 degrees Celsius.

  • Modify the Interest program in Listing 2.3 to print the amount with no more than two decimal places. You can do so without printf with clever use of the int operator, multiplication, and division.

  • + Share This
  • 🔖 Save To Your Account