From owner-freebsd-questions@FreeBSD.ORG Tue Nov 11 13:11:18 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E82B516A4CE for ; Tue, 11 Nov 2003 13:11:18 -0800 (PST) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id C04F643FCB for ; Tue, 11 Nov 2003 13:11:14 -0800 (PST) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [127.0.0.1]) hABLB1nx005803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Nov 2003 21:11:10 GMT (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)id hABLB14o005802; Tue, 11 Nov 2003 21:11:01 GMT (envelope-from matthew) Date: Tue, 11 Nov 2003 21:11:01 +0000 From: Matthew Seaman To: Darryl Hoar Message-ID: <20031111211101.GA4434@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , Darryl Hoar , freebsd-questions@freebsd.org References: <008001c3a896$5cda7f90$0701a8c0@darryl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline In-Reply-To: <008001c3a896$5cda7f90$0701a8c0@darryl> User-Agent: Mutt/1.5.5.1i X-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.60 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on happy-idiot-talk.infracaninophile.co.uk cc: freebsd-questions@freebsd.org Subject: Re: OT - Perl Question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2003 21:11:19 -0000 --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 11, 2003 at 02:57:04PM -0600, Darryl Hoar wrote: > I am trying to learn perl. I am going through a tutorial and have come > across a syntax error I can't figure out. >=20 > Here's the code: >=20 > print "Please tell me your name: "; > chop ($name=3D); >=20 > print "Please tell me your nationality: "; > chop ($nation=3D); >=20 > if ( $nation eq "British" or $nation eq "New Zealand" ) > { > print "Hallo $name, pleased to meet you!\n"; >=20 > } >=20 > when I try to run it, it generates a compile errors on the > if line. >=20 > I know its the conditional test, but don't know how to fix > it to be syntactically correct in perl. >=20 > Any help? Works fine if you ask me: happy-idiot-talk:/tmp:% cat > foo.pl #!/usr/bin/perl -w =20 print "Please tell me your name: "; chop ($name=3D); =20 print "Please tell me your nationality: "; chop ($nation=3D); =20 if ( $nation eq "British" or $nation eq "New Zealand" ) { print "Hallo $name, pleased to meet you!\n"; =20 } =20 happy-idiot-talk:/tmp:% perl -cw foo.pl=20 foo.pl syntax OK happy-idiot-talk:/tmp:% chmod +x foo.pl=20 happy-idiot-talk:/tmp:% ./foo.pl=20 Please tell me your name: Matthew Please tell me your nationality: British Hallo Matthew, pleased to meet you! =20 There was probably a typo in your original script which you've managed to inadvertently fix when you copied your code into the e-mail. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --zhXaljGHf11kAtnf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/sVBldtESqEQa7a0RAruOAKCDfDPh7kF8QP3cYg8V1yl8k0Py5QCfVEag kS5Vj+PfHpG6zDszcN/dMrE= =GGvz -----END PGP SIGNATURE----- --zhXaljGHf11kAtnf--