Just a note - running win2k and perl v5.8.0 (built for

-----Original Message-----
From: Derek Byrne
Sent: 27 June 2003 00:13
To: [email protected]
Subject: Re : Compilation Errors

Hi All,
Reading through Learning Perl (3rd Ed), and messing around with Binary
Assignment Operators (2.5.3).

Code is as follows :
#!perl -w
$fred = 4;
print "Fred is now : $fred \n";
$fred += 4;
print "Add 4 to Fred : $fred \n";
$fred *= 2;
print "Multiply by 2 : $fred \n";
$fred -= 6;
print "Subtract 6 : $fred \n";
$fred /= 2;
print "Divide by 2 : $fred \n";
#$fred .= 5
$fred = $fred . 5
print "$fred \n";

And I get the following error :

C:\SCRIPTS\test>perl fred.pl
syntax error at fred.pl line 14, near "print"
Execution of fred.pl aborted due to compilation errors.

What I'm trying to do is to append 5 to the value of $fred. If you
comment out the last 3 lines, you get 5 as the value for $fred.

Is this a valid assignment? Is it possible to paste in a number to the
end of another number to make a new number? (In this case, 55).

I've also tried encapsulating the value of 5 with and without '' "" and ``

And I don't reckon changing Fred into Barney will work either :o)

Thanks in advance,


Meteor web site http://www.meteor.ie

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
postedJun 26, '03 at 11:19p
activeJun 26, '03 at 11:19p

1 user in discussion

Derek Byrne: 1 post



site design / logo © 2023 Grokbase