My ultimate goal is to reproduce the code here:
http://www.unix.org.ua/orelly/perl/cookbook/ch02_02.htm
which means being able to recognize various strings as various classes of
number:
warn "has nondigits" if /\D/;
warn "not a natural number" unless /^\d+$/; # rejects -3
warn "not an integer" unless /^-?\d+$/; # rejects +3
warn "not an integer" unless /^[+-]?\d+$/;
warn "not a decimal number" unless /^-?\d+\.?\d*$/; # rejects .2
warn "not a decimal number" unless /^-?(?:\d+(?:\.\d*)?|\.\d+)$/;
warn "not a C float"
unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
As a sidenote, in an earlier thread:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg05416.html
I asked about converting numbers to a string. I thought I would try out the 8 !:
approach for fun: http://www.jsoftware.com/help/dictionary/dx008.htm
but the page does not show how to convert strings to numbers.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm