• Subject: Re: Extract number from character field(Perl syntax) (wayy off topic)
  • From: "Carl Galgano" <cgalgano@xxxxxxxxxxxxxxxxx>
  • Date: Mon, 8 Nov 1999 15:18:59 -0500

Sounds a lot like APL, very cryptic, but powerful, evaluation take place
from right to left, excellent for muti dimensional arrays, tables, etc.
Wrote it years ago on an old IBM370.  There is a company called Eventra
(formerly called The APL Group) that sells a commercial EDI translator
written entirely in APL, boy is it fast, and it is interpreted.
CJG
Carl Galgano
EDI Consulting Services, Inc.
540 Powder Springs Street
Suite C19
Marietta, GA  30064
770-422-2995
mailto: cgalgano@ediconsulting.com
http://www.ediconsulting.com
EDI, Communications and AS400 Technical Consulting

-----Original Message-----
From: Carl Friedberg <friedberg@exs.esb.com>
To: 'MIDRANGE-L@midrange.com' <MIDRANGE-L@midrange.com>
Date: Monday, November 08, 1999 2:51 PM
Subject: RE: Extract number from character field(Perl syntax) (wayy off
topic)


>I am a VMS system administrator and pretty good with networking, Windows
NT,
>various IBM os, and 40 years of experience (almost). I nearly choked when I
>saw the one-liner, but Perl is famous for one liners.
>
>This shows the good, the bad, and the ugly, in perl.
>
>At first, I couldn't believe it would work, so I tried it (on nt, but it
>doesn't matter with perl -- that's part of the good).
>
>The perl regular expression engine apparently looks at this from right to
>left:
>
>/\d+/g
>
>(the forward slash is a boundary character for match or substitute
>expressions; anything between the two // is a regular expression, to be
used
>for matching or substituting)
>
>the \d means a single character which is in the range 0-9
>\d+ means one or more of those; thus the match operation is 1 or more
>digits
>
>/\d+/g means (the g stands for global) repeat the (match) operation as many
>times as possible within the string.
>
>$str =~ /\d+/g
>
>This is a frequent expression seen in almost all perl programs. The =~
>operator is the match operator; it says take the string on the left and see
>what matches can be obtained with the regular expression on the right (you
>may add an m between the tilde and the first forward slash, but it's not
>required).
>
>Now comes the part about Perl that I hate: perl magic
>
>The entire expression is evaluated, and returns a result. If the result is
a
>list, the list will contain each of the matches. The expression
>
>@num = ($str =~ /\d+/g) ;
>
>tells perl to place each of the matches in the array num. Thus, the first
>match will be in $num[0]; the second in $num[1]; etc. I would never have
>figured this out without actually trying it, but, in perl, it does make
>sense.
>
>Perl has a steep learning curve (I've been doing it on and off for four
>years now, and I still feel like a beginner). It's also available on almost
>every platform, hardware and software, you could imagine: most IBM os,
>almost every conceivable flavor of *n*x; VMS, nt; and MAC-os.
>
>Carl Friedberg, carl@comets.com
>
>-----Original Message-----
>From: Joel Fritz [mailto:JFritz@sharperimage.com]
>Sent: Monday, November 08, 1999 12:30 PM
>To: 'MIDRANGE-L@midrange.com'
>Subject: RE: Extract number from character field(Perl syntax)
>
>
>No offense, Hans, but what does this say about the "typical Perl
>programmer?"
>
>> -----Original Message-----
>> From: boldt@ca.ibm.com [mailto:boldt@ca.ibm.com]
>> Sent: Monday, November 08, 1999 8:29 AM
>> To: MIDRANGE-L@midrange.com
>> Subject: RE: Extract number from character field
>>
>>
>       /*          Snip                                */
>>
>>
>> >>
>> >>      @nums = $str =~ /\d+/g;
>> >
>       /*          Snip                                */
>>
>> Believe it or not, that code is clear as a bell to a
>> typical Perl programmer!
>>
>> Cheers!  Hans
>>
>> Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com
>>
>>
>> +---
>> | This is the Midrange System Mailing List!
>> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
>> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
>> | To unsubscribe from this list send email to
>> MIDRANGE-L-UNSUB@midrange.com.
>> | Questions should be directed to the list owner/operator:
>> david@midrange.com
>> +---
>>
>+---
>| This is the Midrange System Mailing List!
>| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
>| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
>| To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
>| Questions should be directed to the list owner/operator:
>david@midrange.com
>+---
>+---
>| This is the Midrange System Mailing List!
>| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
>| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
>| To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
>| Questions should be directed to the list owner/operator:
david@midrange.com
>+---

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].