Data Type (Part 1- Scalar Variable)
Scalar Variable
number: including the integer and float number. all number will be converted into double in internal perl
1000
10.24
1.25e45
012 #Octal number
0x12 #Hex number
number operator: +-*/%
number logical comparion: > < == >= <= !=
string: single-quoted strings
'hello' #hello
'don\'t' #don't
'silly\\me' #silly\me
'hello\n' #hello\n
'hello $name' # hello $name
double-quoted strings
"hello world\n" # hello world and new line
"coke\tsprite" #coke+a tab+sprite
"my name is $name" #my name is zhengol, if $name="zhengol"
string operator:. x
"abc"."def" #abcdef
"abc"x4 #abcabcabc
(3+2)x5 #55555
string logical comparaion: eq lt gt ne le ge
Notes: the numeric and string comparions are roughly oppposite of what they are for the Unix which uses -eq for string comparison and == for numeric comparison
(To be continued)
No comments:
Post a Comment