Whitespaces in Perl

A Perl program does not care about whitespaces. Following program works perfectly fine −

print    "Hello, world\n";

But if spaces are inside the quoted strings, then they would be printed as is. For example −


 Live Demo

# This would print with a line break in the middle
print "Hello


This will produce the following result −


All types of whitespace like spaces, tabs, newlines, etc. are equivalent to the interpreter when they are used outside of the quotes. A line containing only whitespace, possibly with a comment, is known as a blank line, and Perl totally ignores it.