Changes

From SME Server
Jump to navigationJump to search
422 bytes removed ,  15:59, 28 December 2013
Line 56: Line 56:  
Perl statements end in a semi-colon:
 
Perl statements end in a semi-colon:
   −
     [http://perldoc.perl.org/functions/print.html print] "Hello, world";
+
     print "Hello, world";
    
Comments start with a hash symbol and run to the end of the line
 
Comments start with a hash symbol and run to the end of the line
Line 64: Line 64:  
Whitespace is irrelevant:
 
Whitespace is irrelevant:
   −
     [http://perldoc.perl.org/functions/print.html print]
+
     print
 
     "Hello, world"
 
     "Hello, world"
 
     ;
 
     ;
Line 76: Line 76:  
Double quotes or single quotes may be used around literal strings:
 
Double quotes or single quotes may be used around literal strings:
   −
     [http://perldoc.perl.org/functions/print.html print] "Hello, world";
+
     print "Hello, world";
     [http://perldoc.perl.org/functions/print.html print] 'Hello, world';
+
     print 'Hello, world';
    
However, only double quotes "interpolate" variables and special characters such as newlines (\n ):
 
However, only double quotes "interpolate" variables and special characters such as newlines (\n ):
   −
     [http://perldoc.perl.org/functions/print.html print] "Hello, $name\n"; # works fine
+
     print "Hello, $name\n"; # works fine
     [http://perldoc.perl.org/functions/print.html print] 'Hello, $name\n'; # prints $name\n literally
+
     print 'Hello, $name\n'; # prints $name\n literally
    
Numbers don't need quotes around them:
 
Numbers don't need quotes around them:
   −
     [http://perldoc.perl.org/functions/print.html print] 42;
+
     print 42;
    
You can use parentheses for functions' arguments or omit them according to your personal taste. They are only required occasionally to clarify issues of precedence.
 
You can use parentheses for functions' arguments or omit them according to your personal taste. They are only required occasionally to clarify issues of precedence.
   −
     [http://perldoc.perl.org/functions/print.html print]("Hello, world\n");
+
     print ("Hello, world\n");
     [http://perldoc.perl.org/functions/print.html print] "Hello, world\n";
+
     print "Hello, world\n";
    
More detailed information about Perl syntax can be found in [http://perldoc.perl.org/perlsyn.html perlsyn].
 
More detailed information about Perl syntax can be found in [http://perldoc.perl.org/perlsyn.html perlsyn].

Navigation menu