Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

In Perl, if $var = "1"; and you print 'You win $var dollar'; what would it return?

 

1. You win $var dollar

2. You win $1 dollar

3. You win1 dollar

4. You win0 dollar

user-image
Question added by Emad Mohammed said abdalla , ERP & IT Software, operation general manager . , AL DOHA Company
Date Posted: 2015/08/29
Emad Mohammed said abdalla
by Emad Mohammed said abdalla , ERP & IT Software, operation general manager . , AL DOHA Company

In Perl when the print statement is using a single quote (') instead of a double quote (") Perl prints the exact characters. This means even if $var is a variable it will not be treated as one because Perl is printing the actual dollar sign. If you wanted to print the variable, so it shows how many dollars have been won you would type: "You win $var dollars"; as the command.

Mohsin Patel
by Mohsin Patel , Accounting Analyst , Water G.

You win $var dollar, whatever variable value is.

More Questions Like This