Development, round II

From: Peter Prymmer <pvhp_at_forte.com>
Date: Wed Jan 28 17:32:56 1998

classiccmp_at_u.washington.edu
Subj: Re: Re[3]: Development, round II

Roger Merchberger wrote:

!>REXX is/was
!>quite a nice language to use, but some features rendered it unsuitable
!>for serious programming - numbers, for example, are stored as strings of
!>digits in the character code of the machine you are using...
!
!Uh, Sir Philip?
!
!Maybe there are other reasons that your statement of unsuitability stands,
!but I can think of one programming language that's very handy (& powerful &
!serious) which stores it's digits as charcter codes: Perl. From experience
!I can tell you that one heckuva lot more stuff gets done with Perl on the
!WWW than Java -- and it's a lot easier to pgm. in.
!
!Guess what! This is still ontopic for this list... there's a version of
!Java for almost every 16-bit or higher machine available -- including a
!native version that runs on an Atari ST... (version 4.035 and I think you
!need a meg to run it -- I've done it!)

But Perl is 10 years old and Java is not. It is still quite easy to
distinguish a perl scalar that contains a numeric value from one that does
not. From the old FAQ you add 0 to see if the thing remains unchanged:

$ perl -e '$s = "a"; if ($s + 0 eq $s) {print "num"} else {print "string"}'
string
$ perl -e '$s = "1"; if ($s + 0 eq $s) {print "num"} else {print "string"}'
num

See also "perlfaq4: Data:Misc: How do I determine whether a scalar is a
number/whole/integer/float?" at
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html
for a whole slew of regular expressions for numbers.

BTW Tcl runs on a bunch of platforms and treats many things like strings as
well (hence it requires the expr() call for numeric evaluation and has
trouble with data containing embedded nulls (whereas perl does not)).

Apologies to folks (such as myself :) who tire of language wars though.
If the original poster wanted to run Rexx I say let them.

Peter Prymmer
(Someone who just spent a great deal of time porting perl to MVS recently)
Received on Wed Jan 28 1998 - 17:32:56 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:30:58 BST