[Melbourne-pm] Important whitespace

Jacinta Richardson jarich at perltraining.com.au
Thu Oct 12 01:09:29 PDT 2006

Most of the time we say that Perl doesn't care about white space.  We all know 
that *sometimes* it does, for example:

	print "$a [0]";

is not the same as:

	print "$a[0]";

but that seems pretty easy to grasp and most people go on believing that by and 
large white space doesn't matter.

So, can you guess (before running it) what happens with the following code?

	$a = 10;
	$b = 20;
	print $a +$b;

how about:

	use warnings;
	use strict;

	my $c = 10;
	my $d = 20;
	print $c +$d;

Cute huh?  All the best,


More information about the Melbourne-pm mailing list