FAQ
Just a note - running win2k and perl v5.8.0 (built for
MSWin32-x86-multi-thread).

-----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,

DerekB


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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedJun 26, '03 at 11:19p
activeJun 26, '03 at 11:19p
posts1
users1
websiteperl.org

1 user in discussion

Derek Byrne: 1 post

People

Translate

site design / logo © 2023 Grokbase