#!/usr/bin/perl # Scalar is a number or a character string. # String $string = 'Perl is great!'; print "String example: \n$string\n\n"; # Number $number = 100; print "Number example:\n$number\n\n"; # String to number conversion (automagically - context) $number = '1'; $number = $number + 1; print "String to number conversion example:\n$number\n\n"; # Number to string conversion (concatination) $number = 1; print "Number to string conversion example:\n\$number = " . $number . "\n\n"; # Variable interpolation (quotes) $string = 'Larry Wall created'; print "Variable interpolation:\n$string Perl.\n"; print 'Variable interpolation:\n$string Perl.\n\n'; print "\n\n"; # undef undef($string); printf("undef string: %s\n", $string); printf("undef number: %d\n\n", $string);