When I run this program:
#!/usr/bin/perl -w
$a=1;
$b=2;
print qq(The statement "$a = $b" is); if ($a == $b) {# value is 2, therefore true print " true";} else{print " false";}
I get "Missing right curly or square bracket at perlt.txt line 5, at end of line
syntax error at perlt.txt line 5, at EOF
Execution of perlt.txt aborted due to compilation errors."
Yet when I spread it out to look like this:
#!/usr/bin/perl -w
$a=1;
$b=2;
print qq(The statement "$a = $b" is); if
($a == $b) {# value is 2, therefore true
print " true";}
else{print " false";}
It runs fine. I don't understand why Perl, which is supposed to be free form, is refusing to run the first program, even though it is exactly the same as the second except for the spacing.
Thanks
Dave
#!/usr/bin/perl -w
$a=1;
$b=2;
print qq(The statement "$a = $b" is); if ($a == $b) {# value is 2, therefore true print " true";} else{print " false";}
I get "Missing right curly or square bracket at perlt.txt line 5, at end of line
syntax error at perlt.txt line 5, at EOF
Execution of perlt.txt aborted due to compilation errors."
Yet when I spread it out to look like this:
#!/usr/bin/perl -w
$a=1;
$b=2;
print qq(The statement "$a = $b" is); if
($a == $b) {# value is 2, therefore true
print " true";}
else{print " false";}
It runs fine. I don't understand why Perl, which is supposed to be free form, is refusing to run the first program, even though it is exactly the same as the second except for the spacing.
Thanks
Dave