Perl

  • Use perl -e 'code' to execute one line of code in perl.
  • use strict; is a compiler flag that tells the compiler to change its behavior in certain ways: 
  1. generates a compile-time error if you access a variable without declaration.
  2. generates a run-time error if you use symbolic references.
  3. generates a compile-time error if you use a bareword identifier (no quotes on a string).
  • use warnings; is used to catch unsafe code. It will disallow certain programming constructs and techniques. It just looks for the most common scripting error and syntax errors.
  • use version; to use a specific version of Perl.
  • print command in Perl does not add a new line at the end of the string. For this, we have the say command which appends a '\n' at the end of every line.
  • You can use q{} in place of '' and qq{} in place of "".

Comments