User Input ========== $name = ; Double Quoted Strings vs Single Quoted Strings ============================================== Double Quoted strings allow certain values in the string to be interpreted and single quoted strings are not. For example: print "Hello world!\n; ---> Helo World! (+ newline) print 'Hello World!\n'; ---> Hello World!\n (no newline) Here's some common escape characters to utilize in double quoted strings: \n - Newline \t - Tab \b - Backspace \l - Lowercase Next Letter \u - Uppercase Next Letter \a - Ring System Bell Manipulating Strings --------------------- Chop --------------------- The chop function is used to "chop off" the last character of a string variable. This is commonly used to take the "\n" newline character off a string when you read it from a file. chop ($string); --------------------- Length --------------------- The length function simply gives you back the number of characters in a string variable. $string="hello world"; $length_string = length ($string); As "hello World" is 11 characters long, the $length_string variable will be 11. --------------------- Substring (substr) --------------------- The substring function is a way to get a portion of a string value, rather than using the entire value. $portion = substr($string, start number, length); So, if we had a variable named $string with a value of "hello world", but we wanted to get the last five characters rather than the full string, we would write something like this: $string="hello world"; $portion = substr($string, 6, 10); print "It's a big $portion\n"; Remember to start counting form zero. In the above case the letter 'h' is zero. Combining Strings - The Dot(.) Operator ======================================= "Hello"."World" ---> HelloWorld "Hello"." "."World" ---> Hello World $user="Bob"; print "Hello ".$user; ---> Hello Bob Repeating Strings - The x Operator ================================== "Hello" x 5 ---> HelloHelloHelloHelloHello