[6688] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 313 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 16 08:07:10 1997

Date: Wed, 16 Apr 97 05:00:38 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 16 Apr 1997     Volume: 8 Number: 313

Today's topics:
     Re: "Dummies" book any good? (Jonathan Peterson)
     Re: "Dummies" book any good? (Tad McClellan)
     Re: "my" variable affects namespace "outside" block? (David Alan Black)
     Re: [Q] Converting a string to lower case (Andy Wardley)
     Array Elements (Gary Chambers)
     Array Elements (Gary W. Chambers)
     Re: Array Elements (Tad McClellan)
     Re: Arrays (James A. Robinson)
     Re: Can we create an executable of perl program (Malcolm Beattie)
     FAQ's --BUSTED-- (Brian Lavender)
     Re: How do I randomly re-order the lines of a file? <dbenhur@egames.com>
     Re: how to get perl handle elm's receive automatically <E.H.Beekman@amc.uva.nl>
     Re: how to use a system-installed Perl w/locally downlo (Eric D. Friedman)
     Number of Array Elements (Gary Chambers)
     Re: on the absence of constant objects (Steffen Beyer)
     Re: Ousterhout and Tcl lost the plot with latest paper <jay.krell@cornell.edu>
     Re: Ousterhout and Tcl lost the plot with latest paper (Cyber Surfer)
     Re: Parsing hex characters (brian d foy)
     Re: Parsing hex characters <gwhassan@prodigy.net>
     Re: Perl Compiler (B Module) And GDBM_File DB's (Malcolm Beattie)
     Re: Perl Variable Passing Help Needed (James A. Robinson)
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Richard A. O'Keefe)
     Re: Shopping Cart type question. (James A. Robinson)
     Re: substituting with /g and simulating "lookbehind" (f <himanshu@indiaworld.co.in>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 16 Apr 1997 10:51:40 GMT
From: jon@amxdigital.com (Jonathan Peterson)
Subject: Re: "Dummies" book any good?
Message-Id: <3354ab99.3478663@news.sonnet.co.uk>

On Tue, 15 Apr 1997 20:20:44 -0700, "Charles F. Ritter"
<critter@quack.kfu.com> wrote:

>Tom Christiansen wrote:
>> 

>> Nonetheless, attempting to learn Perl from its reference
>> work may be similar to learning English with only a dictionary.
>> 

>The camel book is twice as interesting the second time through and ten
>times as interesting on the third read.
>
>Come to think of it... so is the dictionary. :-)

Doubtless I'l get in trouble for this, but...

I learnt to program with Commodore64 basic. After my C64 broke down, I
slowly forgot how to program, until I got an old 386, and learnt to
program qbasic.

People familiar with either of these 'languages' will know that they
are not elegant by todays standards. However, by the time I came to
learn Perl ( initially from tutorials found on the net, then from the
cammel), I realised just how much I knew. I knew what a variable was.
I knew what an array was. I was familiar with for... next loops. I
knew what a subroutine was (anyone remember gosub ? :).

Knowing this makes it MUCH easier to learn how to use Perl's list
handling functions and regexps, because you feel so much more
confident with the rest of it. For a real, genuine, absolutely never
programmed before not even Dos batch files or Word macros person, I
think you really need to start with stuff like what a variable is, and
spend a long time on it.

If you have never programmed anything before, I think Perl is not an
ideal starting place. This is NOT because Perl is inherently difficult
(as many people think...), but because Perl is inherently clever, and
writers of books are so eager to show the cleverness, they take the
simple things as read.

Explaining to a real beginner that:

if ($a == 1) {
	print ("Whee!");
	}

is the same as

$a || print ("Whee!");

is not something that you can do in a few sentences. More like a few
chapters.

I suggest you learn a clumsy, clunky old thing like basic. Then you'll
be impressed by Perl's cleverness, and able to make use of it without
getting confused over the basics.


-----
Jon Peterson.
Views expressed are mine, not AMXdigital's.
Look young! Feel young! Die young!
----
AMXdigital: +44 171 613 5300 www.amxdigital.com
jon@amxdigital.com


------------------------------

Date: Wed, 16 Apr 1997 05:18:49 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: "Dummies" book any good?
Message-Id: <9292j5.km.ln@localhost>

Jonathan Peterson (jon@amxdigital.com) wrote:

: Doubtless I'l get in trouble for this, but...


Here it comes ;-)


: I learnt to program with Commodore64 basic. After my C64 broke down, I
: slowly forgot how to program, until I got an old 386, and learnt to
: program qbasic.


I learned with BASIC on a Timex Sinclair with 2Kb of memory  ;-(


: People familiar with either of these 'languages' will know that they
: are not elegant by todays standards. However, by the time I came to
: learn Perl ( initially from tutorials found on the net, then from the
: cammel), I realised just how much I knew. I knew what a variable was.
: I knew what an array was. I was familiar with for... next loops. I
: knew what a subroutine was (anyone remember gosub ? :).

: Knowing this makes it MUCH easier to learn how to use Perl's list
: handling functions and regexps, because you feel so much more
: confident with the rest of it. For a real, genuine, absolutely never
: programmed before not even Dos batch files or Word macros person, I
: think you really need to start with stuff like what a variable is, and
: spend a long time on it.

: If you have never programmed anything before, I think Perl is not an
: ideal starting place. This is NOT because Perl is inherently difficult
: (as many people think...), but because Perl is inherently clever, and
: writers of books are so eager to show the cleverness, they take the
: simple things as read.


That is the real problem. Learning Perl is not that hard. Learning
to program *is* hard. Doing both simultaneously may well be harder
still...


: Explaining to a real beginner that:

: if ($a == 1) {
: 	print ("Whee!");
: 	}

: is the same as
  ^^^^^^^^^^^^^^

???

Is, sometimes, kinda similar to:


: $a || print ("Whee!");

-----------------
#! /usr/bin/perl -w

$a = 1;

if ($a == 1) {
        print ("Whee 1!\n");
        }

$a || print ("Whee 2!\n");
-----------------

prints only "Whee 1!".

if $a is undef, 
   $a=0, 
   $a='0',
   $a=''       then it prints only "Whee 2!"



: is not something that you can do in a few sentences. More like a few
: chapters.


It is not something you can do *at all*, because they are _not_
the same...  ;-)


: I suggest you learn a clumsy, clunky old thing like basic. Then you'll
: be impressed by Perl's cleverness, and able to make use of it without
: getting confused over the basics.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: 16 Apr 1997 10:08:55 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: "my" variable affects namespace "outside" block?
Message-Id: <5j28fn$308@pirate.shu.edu>

jfw@wral-tv.wral-tv.com (John F. Whitehead) writes:

>Could someone please explain the following to me?  (nicely?)
>Why does the following program, which uses a "my" variable in a loop,
>not get confined to the block it's in, and instead affect the variable the
>next time it's used?  Example:

I couldn't duplicate your error:

1 file is `one'
3 file is `one'
1 file is `two/'
2 file is `two/'
1 file is `three'
3 file is `three'
1 file is `four/'
2 file is `four/'

(output from your original code, with 'my')

It may be version-related - I'm using Perl5.003_95.  I remember (not
in detail, I'm afraid) that there were some version-specific problems
in this area - ?

David Black
dblack@icarus.shu.edu


------------------------------

Date: 16 Apr 1997 08:53:48 +0100
From: abw@peritas.com (Andy Wardley)
Subject: Re: [Q] Converting a string to lower case
Message-Id: <5j20ic$dej@aoxomoxoa.peritas.com>

<amas@lhr-sys.dhl.com> wrote:
>A bit more detail might help: specifically I would like
>to take a string that contains any sort of character and only change
>the case of the alpabetic characters and leave the rest alone.

#!/usr/bin/perl -w

my $variable = "heLLO worLd!  toDay iS 16-apr-97\n";

# "uc" = "upper case"
print uc $variable;

# same as
print "\U$variable";

# "lc" = "lower case"
print lc $variable;

# same as
print "\L$variable";

# first letter capitalisation
$variable =~ s/     # search for...
            \b      # word boundary
            (\w)    # first "word" character
            (\w*)   # the rest of the "word"
            /       # replace with...
            \U$1    # match 1 converted to upper case
            \L$2    # match 2 converted to lower case
            /gx;    # g = "global" (match all), x = ignore these comments

print $variable;

__END__


The output:

HELLO WORLD!  TODAY IS 16-APR-97
HELLO WORLD!  TODAY IS 16-APR-97
hello world!  today is 16-apr-97
hello world!  today is 16-apr-97
Hello World!  Today Is 16-Apr-97



A


-- 
Andy Wardley <abw@peritas.com>  **NEW** http://www.peritas.com/~abw 
A responsible and professional individual who has no need for silly 
comments, inane banter or bizarre "in-jokes" in his signature file.  


------------------------------

Date: 16 Apr 1997 06:02:09 GMT
From: geecee@burbot.netquarters.net (Gary Chambers)
Subject: Array Elements
Message-Id: <5j1q11$lpq@noc1.gwi.net>

Can someone confirm the correct method of determining the number of
elements in an array?  I'm *VERY* new to Perl, and I've looked in the
Camel book and Llama book and found nothing definitive.  Here's what I
have been able to gather:

[...]
$elements = @array;
print "The number of elements is $elements\n";
[...]

Any help is greatly appreciated.

-- 
GeeCee/NQ

// --------------------------------------
// Gary Chambers <geecee@netquarters.net>
// NetQuarters, Incorporated
// --------------------------------------



------------------------------

Date: 16 Apr 1997 06:21:02 GMT
From: geecee@gwi.net (Gary W. Chambers)
Subject: Array Elements
Message-Id: <5j1r4e$n06@noc1.gwi.net>

Can someone offer definitive information on obtaining the number of 
elements in an array?  Camel and Llama are vague, and I'm using:

[...]
$elements = @array;
print "The number of elements is $elements\n";
[...]

Any help would be greatly appreciated.

Gary Chambers
geecee@netquarters.net


------------------------------

Date: Wed, 16 Apr 1997 05:28:05 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Array Elements
Message-Id: <lj92j5.km.ln@localhost>

Gary Chambers (geecee@burbot.netquarters.net) wrote:
: Can someone confirm the correct method of determining the number of
: elements in an array?  I'm *VERY* new to Perl, and I've looked in the
: Camel book and Llama book and found nothing definitive.  Here's what I
: have been able to gather:

: [...]
: $elements = @array;
: print "The number of elements is $elements\n";
: [...]


That's it.

You just need to be _sure_ that the @array is in a _scalar_ context.

You can force a scalar context if you want:

print "The number of elements is ", scalar(@array), "\n";


: Any help is greatly appreciated.


Or, you could do:

$elements = $#array + 1;  #  $# is the last subscript of @array, add one
                          #  because they start counting with zero (usually)


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: 16 Apr 1997 01:26:29 -0700
From: jimr@aubrey.stanford.edu (James A. Robinson)
Subject: Re: Arrays
Message-Id: <5j22fl$11r@aubrey.stanford.edu>


In article <334AA688.B02@progress.com>, Curt  <peredina@progress.com> wrote:

>1) How do I use arrays instead of temporary files (i.e. multiple record
>arrays) for certain instances when I must recall data from a previous
>action.

I'm not clear on whether or not you mean what I think you mean.  Are
you asking about how to use an array or a hash to store data records?
If so, you should read the Programming Perl book (in any decent
bookstore with a computer section).  Here is an example of adding new
records (in an array) to a hash.

	while(<INPUT>) {
		($name, $contents) = split(/\t/, $_);
		
		if (!defined($memory{$name}) { # make a new memory key
			my @contents;
			push(@contents, $contents);

			$memory{$name} = [ @contents ];
		}
		else { # Add to existing memory key
			my @contents = @{ $memory{$name} };
			push(@contents, $content);
	
			$memory{$name} = [ @contents ];
		}
	}
-- 
Jim Robinson <jim.robinson@stanford.edu> - http://highwire.stanford.edu/~jimr/
HighWire Press -- Stanford University


------------------------------

Date: 16 Apr 1997 11:12:54 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: Can we create an executable of perl program
Message-Id: <5j2c7m$233@news.ox.ac.uk>

In article <3353FF31.41C6@mrc-lmb.cam.ac.uk>,
Jong  <jong@mrc-lmb.cam.ac.uk> wrote:
>pan.dhanwada@teldta.com wrote:
>> 
>> I am calling a perl program using a system command of c
>> 
>> for example
>> 
>> main()
>> {
>> system('x.pl');
>> }
>> 
>> Here the problem is as the perl program is called thousands of times the
>> system is getting slowed down. The main reason for the slow down is as
>> perl program is an interpreter not an executable.
>> 
>> Is there any facility of creating an executable of a perl program.
>> 
>> If anybody knows more about this  please email me
>> 
>> pan.dhanwada@teldta.com
>> 
>> pandu
>
>
>There is a module made by Malcolm Beatie which produces
>compiled perl programs.

But for most people it's better to rethink the program's design
slightly and either make the C code callable from perl (man perlxs)
or embed a perl interpreter in the C code (man perlembed).

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"Widget. It's got a widget. A lovely widget. A widget it has got." --Jack Dee


------------------------------

Date: Wed, 16 Apr 1997 07:17:05 GMT
From: brian@brie.com (Brian Lavender)
Subject: FAQ's --BUSTED--
Message-Id: <335479ea.5950997@nntp.netcruiser>

I just posted a message about this and I will hopefully repost  it
more clearly. Go to 

:http://www.perl.com/perl/faq/

If you select the link "html format" from the following list you will
find it leads you to the large document of the faq's. 

:As one large document in the following formats: 
:          pod format 
:          man format 
:          html format 

This document contains the faq questions at the top. Unfortunately if
you select one of the question links such as below you will find that
instead of leading you to the answer it leads you to the main man page
for perl.

:Data: Strings 
:          How do I validate input? 
:          .
:          .
:          How do I capitalize all the words on one line? 

It should lead you to the answer which is down below in the document.
If you remove the line 

:<BASE HREF="http://www.perl.com/CPAN/doc/manual/html/pod/">

from the document source and reopen it from a new file it works
properly. I hope this helps people who have tried to read the FAQ's,
but could not figure it out.

Brian
----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley     http://www.brie.com/bbd 
(707) 226-8891

"The world is a good place if you are in a good position."


------------------------------

Date: Tue, 15 Apr 1997 23:18:43 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: "Adam H. Lewenberg" <adam@orion.math.uiuc.edu>
Subject: Re: How do I randomly re-order the lines of a file?
Message-Id: <33546F43.4B@egames.com>

[mail&post]
Adam H. Lewenberg wrote:
> I need to RANDOMLY re-order the lines of a small text file (between 20
> and 50 lines).

srand(time ^ ($$ + ($$<<15)));
my @lines = <STDIN>;
print( splice(@lines, int(rand(@lines)), 1) ) while (@lines);

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"No, I'm not going to explain it. If you can't figure it out, 
 you didn't want to know anyway..." --Larry Wall



------------------------------

Date: Wed, 16 Apr 1997 09:59:41 +0200
From: Ewald Beekman <E.H.Beekman@amc.uva.nl>
Subject: Re: how to get perl handle elm's receive automatically
Message-Id: <335486ED.2FCE@amc.uva.nl>

If you mean the arrival of new mail (instead of the arrival
op a new elm package) you can get procmail from:
--
The latest version can be obtained directly from the ftp-archive at:

        ftp.informatik.rwth-aachen.de (137.226.225.3)

as (g)zipped tar file:     /pub/packages/procmail/procmail.tar.gz      
<160KB
as compressed tar file:    /pub/packages/procmail/procmail.tar.Z       
<224KB
--
works great for me in automatically splitting up mail from
several mailing lists and dumping spam's
Ewald...

Maverick wrote:
> 
> hi all,
> 
> I want to write a perl script to auto-detect
> elm's new arrival and parse it into several files
> 
> has perl has this ability to auto-detect? or I shall
> daemon programming?
> 
> rgds
> robert

--
Ewald H. Beekman, Academical Medical Center, The Netherlands
E.H.Beekman@amc.uva.nl, phone +31 20 5667085, fax .. 5669020


------------------------------

Date: 16 Apr 1997 08:27:12 GMT
From: friedman@medusa.acs.uci.edu (Eric D. Friedman)
Subject: Re: how to use a system-installed Perl w/locally downloaded modules
Message-Id: <5j22h0$ool@news.service.uci.edu>

[mailed, posted]

In article <ysiz912jvdsa.fsf@bufo.usc.edu>,
Terrence M. Brannon <brannon@bufo.usc.edu> wrote:
>friedman@medusa.acs.uci.edu (Eric D. Friedman) writes:
>> 
>>        use lib '/path/to/my/perllib';
>this part failed

Yes, because you didn't include it!  See below.

>Writing /export/freeway/brannon/perllib/lib/site_perl/alpha-dec_osf/auto/Data/Flow/.packlist
>/bin/sh: /export/freeway/brannon/perllib/lib/alpha-dec_osf/5.003/perllocal.pod: cannot create
>make: *** [doc_site_install] Error 1

You should `touch' this file so that you don't get these errors.  Not
sure where they come from or why sh can't create the file, but touch
ironed out that problem for me.

>main::(-e:1):   42
>  DB<1> use Data::Flow '/export/freeway/brannon/perllib'
>Can't locate Data/Flow.pm in @INC at (eval 4) line 2, <IN> chunk 1.
>BEGIN failed--compilation aborted at (eval 4) line 2, <IN> chunk 1.
>
>  DB<2> use Data::Flow '/export/freeway/brannon'
>Can't locate Data/Flow.pm in @INC at (eval 6) line 2, <IN> chunk 2.
>BEGIN failed--compilation aborted at (eval 6) line 2, <IN> chunk 2.
>
>  DB<3> use Data::Flow '/export/freeway/brannon/perllib/lib/site_perl'
>Can't locate Data/Flow.pm in @INC at (eval 8) line 2, <IN> chunk 3.
>BEGIN failed--compilation aborted at (eval 8) line 2, <IN> chunk 3.

Naturally none of these will work since you didn't follow the
instructions I (and Nathan) sent and which you quote at the top of
your message.

use lib '/path/to/my/perllib';  # includes your personal modules directory
                                # in @INC
use Data::Flow;                 # loads the specific module you want to use.
                                # perl can find it thanks to the use lib
                                # directive.
-- 
Eric D. Friedman
friedman@uci.edu


------------------------------

Date: 16 Apr 1997 06:10:44 GMT
From: geecee@burbot.netquarters.net (Gary Chambers)
Subject: Number of Array Elements
Message-Id: <5j1qh4$mec@noc1.gwi.net>

I'm trying to determine the number of elements in an array.  Is it
correct to use:

$elements = @array;

Any help will be appreciated...  Camel and Llama are unclear to me.

-- 
GeeCee/NQ

// --------------------------------------
// Gary Chambers <geecee@netquarters.net>
// NetQuarters, Incorporated
// --------------------------------------



------------------------------

Date: 16 Apr 1997 07:43:01 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: on the absence of constant objects
Message-Id: <5j1vu5$eo5$1@en1.engelschall.com>

Stijn van Dongen <stijnvd@cwi.nl> wrote:

> 	Recently I wrote a perl library for sorting a Russian--Dutch
>  dictionary. The dictionary has a couple of hundreds of thousands of lemma's,
>  and as expected, different information has to be generated for various kinds
>  of comparison (punctuation, field entry characteristics etc.). All in all it
>  has become a program of slightly less than 3000 (generously spaced) lines of
>  code, a large part of which is devoted to I/O, and a large part of which is
>  caused by the fact that sorting has to be done in stages of two kinds (output
>  is split up in segments, and sorting information is created in increasingly
>  narrower domains).

>  I took great care to do the sorting only on indices which represent the
>  lemma's. One reason is efficiency, but the most important reason is safety.
>  Now, it would have been a great relief had I been able to declare the array
>  in which the lemma's are stored as a constant array. No matter how careful I
>  construct the code, no matter my proficiency level as a programmer, it _would_
>  have been nice. It may grieve perl's heart that its ability to shrink, grow
>  and modify arrays is in this specific case is not so highly appreciated -- they
>  were of course bravoed in other parts of the program.

>  In the Ousterhout white paper thread, a copla things were said about
>  scripting languages and system languages, including stuff about weak/strong
>  typing, object oriented programming etc. What I found missing in perl,
>  on this occasion, was the option of making an object _constant_.
>  It is a diffent dimension than typing, and perhaps a dimension that is
>  rather more important for larger applications. Any thoughts?

It is no problem to write an XS module which provides write-protection for
Perl variables and objects, because internally, all Perl variables have a
flag for write-protection. (Perl's built-in variables make heavy use of
this feature!)

I wouldn't be surprised if such a module exists already. Check "The Perl 5
Module List" in comp.lang.perl.modules and on www.perl.com!

If not, tell me, I'll write it!

(Actually, it's almost finished already)

Hope this helps!

Yours,
-- 
    |s  |d &|m  |    Steffen Beyer <sb@sdm.de> (+49 89) 63812-244 fax -150
    |   |   |   |    software design & management GmbH & Co. KG
    |   |   |   |    Thomas-Dehler-Str. 27, 81737 Munich, Germany.
                     "There is enough for the need of everyone in this world,
                     but not for the greed of everyone." - Mahatma Gandhi


------------------------------

Date: 16 Apr 1997 09:35:58 GMT
From: "Jay Krell" <jay.krell@cornell.edu>
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <01bc4a49$ab8269d0$aad323c7@drugs>

That's easy. If you don't find the backslashes:
\java\doc\guide\innerclasses\spec\innerclasses.doc1.html

Inner classes result from the combination of block structure with
class-based programming, which was pioneered by the programming language
Beta

Too many good systems, too little time..

 - Jay


Jesper Buus Nielsen <buus@daimi.aau.dk> wrote in article
<01bc4550$a291dde0$d412e182@lissi.daimi.aau.dk>...
> 
> 
> Kelly Murray <kem@math.ufl.edu> skrev i artiklen
> <5iboqu$qhk$1@sparky.franz.com>...
> > It's only because people can't seem to stop using C/C++ 
> > that there is demand for inefficient "scripting" languages.
> > 
> > Common Lisp has so much versatility that it can be used for both
 ....
> environment. NB: CLOS were a significant source of inspiration in
designing
> BETA - and BETA, being one of the first languages fully combining
locality
> (block structure) and OO,  was the main source of inspiration in making
up
> the "inner classes" of Java - a beer to the one that find the ref. in the
> Java documentations - I know that it is there - saw it :-)  
> 
> (1) Look at: http://www.daimi.aau.dk/~beta/
> (2) Windows [95/NT], Mach., Unix and maybe, to me, unknown systems.
> (3) Forgive me writing that diabolical sequence of characters.
> 
> /Jesper
> 
> > 
> > -Kelly Murray  kem@franz.com   http://www.franz.com
> > 
> > 
> 


------------------------------

Date: Wed, 16 Apr 1997 11:17:19 +0100
From: cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <MPG.dbeb63e1cab1e39989772@news.demon.co.uk>

With a mighty <01bc45a2$98f8ec40$0f02000a@gjchome.nis.newscorp.com>,
gjc@delphi.com uttered these wise words...

> There have been a number of operating systems which emphasize
> language-independant "binary interface" component integration to
> a sufficiently developed degree that multi-language projects are practical
> and robust; however, Microsoft Windows 95/NT seems to have reached
> a significant "breakthrough" level in a way that VMS or AS-400 did not.

Yep, and the latest development is ActiveX (a new name for some old 
ideas from MS, i.e. OLE,OCX,etc). ActiveX Scripting is particularly 
neat, as it'll mean that Windows should be free of most of these 
language wars. Anyone who wants VBScript can have it, anyone who wants 
JavaScript have it, and so on, providing that the script language has 
been packaged as an ActiveX script engine and your app can use it 
ActiveX scripting.

This isn't rocket science, so I'm expecting to see a _lot_ of Windows 
apps using it. MS have made sure that it's easy to add to a apps that 
use MFC classes. I'm no great fan of MS, but I think that this is an 
excellent move, one of the few trully great things that _anyone_ can 
do. In this case, it just happens to be MS.

If you'd like to use a language like Scheme to extend to your 
favourite Windows apps, it'll be easy. Just take your SCM ActiveX 
script engine, and plug it into your favourite app, and bingo! If you 
had the source code to the app, perhaps you could've added Tcl, but 
not many, if any, vendors will supply that. Perhaps if the app uses 
OLE, you could use OLE Automation, but that's a big perhaps. As big as 
ActiveX Scripting? Hmm. We'll see.

I think that the Guile people have also got it right, by supporting 
more than one syntax. If you prefer a C syntax, fine. If there's some 
syntax that you'd like, and it's not currently available, it shouldn't 
be too hard to fix it, and other people can benefit from your work, 
too. Each additional syntax helps make Guile stronger.

Meanwhile, everyone else picks a specific language and then fights to 
the death to continue using it, forcing it on other people, and 
generally wasting a lot of time and effort. Who does that help?

Well, Microsoft, for a start. Bill Gates' dream was once to make Basic 
the script language for everything (like JO and Tcl? Sun and Java? 
Hmm), but MS have now gone beyond that. The reality is that people 
want to use the language that _they_ choose, and some people want to 
use that language exclusively. Fine, now they can do it.

Isn't it ironic that it's _MS_ doing this, and not Sun? What about 
Apple? Perhaps they've been doing this for years, and I've just missed 
it - considering how much bickering people do, it wouldn't be hard.

Keep it up, people. You're making Windows stronger by the minute, by 
holding everything else back. Good luck to you - you may need it.
-- 
<URL:http://www.wildcard.demon.co.uk/> You can never browse enough
  Martin Rodgers | Programmer and Information Broker | London, UK
            Please note: my email address is gubbish.


------------------------------

Date: Wed, 16 Apr 1997 03:56:41 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Parsing hex characters
Message-Id: <comdog-1604970356410001@nntp.netcruiser>

In article <335405D1.7265A426@prodigy.net>, Greg Hassan
<gwhassan@prodigy.net> wrote:

> Alejo Balingit wrote:
> > 
> > The following data comes from the mainframe:
> > 
> >  ^Z|XYZ     | ^Z| 00001.| ^Y|1994-05-10 00:00:00:000|   ? ^Z|ABCD    |
> > ^Y|1994-05-10 00:00:00:000| ^Z|331 | ^Z|    | ? ^B||

> > Notice that the hex characters are removed including the trailing delimiter,
> > but if thare is a "?" in the field AND a hex character, the delimiter is not
> > deleted.  What can I use to check/remove hex characters?

> perl -pi -e 's/\cZ|\cY|\cB//g' filename

perhaps you meant s/ (\cZ|\cY|\cB) //xg;
                     ^-----------^

:)

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


------------------------------

Date: Wed, 16 Apr 1997 01:33:49 +0000
From: Greg Hassan <gwhassan@prodigy.net>
To: brian d foy <comdog@computerdog.com>
Subject: Re: Parsing hex characters
Message-Id: <33542C7D.11AD26E2@prodigy.net>

brian d foy wrote:

>> perhaps you meant s/ (\cZ|\cY|\cB) //xg;
                     ^-----------^

That is probably more complete but more typing involved. :=)

I believe the parenthesis and the 'x' are extraneous.

-Greg

-- 
============================================
                Greg Hassan
          The Independent Solution
 Web Developer (CGI, Java, C, Perl, Oracle)
           http://www.hassan.com/        
    gwhassan@prodigy.net, 1-415-969-5856
============================================


------------------------------

Date: 16 Apr 1997 11:20:34 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: Perl Compiler (B Module) And GDBM_File DB's
Message-Id: <5j2cm2$275@news.ox.ac.uk>

In article <5j160a$4k0$1@news.netusa.net>,
Douglas Warren <dwarren@alpha.netusa.net> wrote:
>Greetings,
>
>The README file for the B Module has us linking with the gdbm libraries,

cc_harness just pulls out some compilation options from your own
Config.pm.

>so I assume there is a way for a compiled program to use GDBM, however,
>the GDBM_File library that comes with perl seems to use the Autoloader,
>so you can't compile it directly.  My question is how do you get a perl
>script that uses GDBM databases to compile properly?

You can either wait for alpha4 which handles AutoLoaded modules
rather better or try using a BEGIN { } block to "prod" the relevant
functions. In other words, force them to be loaded in (possibly in
combination with a -u option or so).

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"Widget. It's got a widget. A lovely widget. A widget it has got." --Jack Dee


------------------------------

Date: 16 Apr 1997 01:00:56 -0700
From: jimr@aubrey.stanford.edu (James A. Robinson)
Subject: Re: Perl Variable Passing Help Needed
Message-Id: <5j20vo$qr@aubrey.stanford.edu>

In article <3346e7c7.474590@nntp.a001.sprintmail.com>,
Frank Fisher <frank@primemail.com> wrote:

>The key variables in this code snippet are $plimit (the perl variable)
>and jlimit (the javascript variable).  $plimit is fetched from an
>ascii file and that works.  In the <BODY onLoad=  I'm trying to pass
>the $plimit variable as an argument to the javascripit function
>init().  I get a syntax error msg around the init( call.

You are not clear about where the syntax error is coming from. The
only possible problem I see is that you aren't making sure that the
$plimit doesn't have extraneous data like a newline in it, so that 
if your CUST file has 

	foo
	fii
	fee
	fum

your code is printing out

	<BODY onLoad="init(foo
);">

on that trouble line.  If you want it to be

	<BODY onLoad="init(foo);">

Then you should be doing

	chomp($plimit = $buffer[0]);

(And there are probably more efficient ways of reading in the first
line of a file, but since it works...)


Jim

-- 
Jim Robinson <jim.robinson@stanford.edu> - http://highwire.stanford.edu/~jimr/
HighWire Press -- Stanford University


------------------------------

Date: 15 Apr 1997 21:13:10 +1000
From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <5ivns6$o09$1@goanna.cs.rmit.edu.au>


Smiljan Grmek <Smi@4mate.hr> writes:

>Michael Sperber [Mr. Preprocessor] wrote:
>*Anyone* is a fairly large concept - please go find an average
>programmer without experience in Tcl and Scheme, present him/her with
>appropriate manuals and have h/h read/write code ...

Bogus constraint.  Many people are quite comfortable picking up an
unfamiliar language from manuals.  Many more are not.  Most people
learn languages by being guided.  It would certainly be interesting
to try the experiment, but I think you would find that the average
programmer would find TCL even weirder than Scheme.  At least in
Scheme you have conventional arrays and assignment statements; you
can *transliterate* Pascal into Scheme a lot of the time and expect
it to work.

>Even a thought experiment gives correct results (if one bears in mind
>the Gaussian distribution of human attributes - necessary for the
>definition of *average* programmer)

You can't expect to get away with that in a newsgroup where some
people actually understand statistics.  To start with, many human
distributions are closer to lognormal than normal, and to continue,
many aren't at all close to either.  (For example, for many years
I have found the distribution of exam results in my classes to be
bi-modal.)  And then the appeal to "the average programmar" is an
appeal to a meaningless concept.  You can make this average as low
as you want by including people who flunked high-school BASIC as
"programmers", or as high as you want by excluding people who
don't understand higher-order predicate calculus.  And then of
course the entire idea of ranking programmers on some sort of
unidimensional scale as if programming involved only one skill
is completely bogus.

>Talk to a pschologist friend about averages and you will find out where

well, talk to a statistician first about the notions of "population",
"sampling frame", "average" (everyone _except statisticians seems to
know what an "average" is; statisticians know of several infinite
families of measures that fit the concept), and "bias".  

>I tested a friend's contention that you
>cannot talk to an IQ 100 - he was mostly right and it was a saddening
>experience.

Hmm.  To start with, "IQ 100" is not a well defined concept.
The measurement error of IQ is around the 5 to 10 point level,
and that's with the same tester administering variants of the
same test to the same subject.  The effect of the tester on the
IQ is is pretty serious.  And then of course _everyone's_ IQ
tends to 100, because the tests run out of things to test, but
smart people keep on learning new kinds of things.  (Consider:
some 80-year-olds learn new human languages.  But IQ tests do
not measure what other languages you know or how well you know them.)
So someone _called_ "IQ 100" could be IQ 90 to IQ 110, and for that
matter, could be considerably smarter than most of the people posting
in this thread, if they were old enough.  (That's a significant
contributor to the famous correlation between IQs of separated twins,
by the way, IQ varies with calendar age, and twins are the same
calendar age.)

To continue, if you really understand something, you can get
_something_ about it across to people.  Heck, there's at least
one American publisher with a high school physics book that has
been entirely purged of mathematics.  Either the publisher is
ripping people off (and the teachers using the book are incompetent)
or they are succeeding in conveying _something_ about physics to
people who would probably fail the maths part of an IQ test.

-- 
Will maintain COBOL for money.
Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.


------------------------------

Date: 16 Apr 1997 01:07:53 -0700
From: jimr@aubrey.stanford.edu (James A. Robinson)
Subject: Re: Shopping Cart type question.
Message-Id: <5j21cp$u9@aubrey.stanford.edu>

In article <33484ac8.19082498@news1.pei.sympatico.ca>,
Dico Reyers <dico@peionline.com> wrote:
>I was wondering if there is a way (I know there is, but not sure how)
>to send a constant piece of information (like a customer ID number)
>between different html pages.

This is a CGI question, not a a perl question. I'm answering it, but
please use the appropriate group (comp.infosystems.www.authoring.cgi)
next time. 

Yes, you can either have

		<A TYPE=HIDDEN NAME="hidden1" VALUE="fooo">

for POST forms. Or you can have your cgi script use a PUT cgi method
instead, in which case you append all the info after the cgi script
name. See O'Reilly's excellent CGI programming book for details.

Follow ups to comp.infosystems.www.authoring.cgi


Jim


-- 
Jim Robinson <jim.robinson@stanford.edu> - http://highwire.stanford.edu/~jimr/
HighWire Press -- Stanford University


------------------------------

Date: Wed, 16 Apr 1997 05:36:40 GMT
From: Himanshu Bafna <himanshu@indiaworld.co.in>
Subject: Re: substituting with /g and simulating "lookbehind" (fwd)
Message-Id: <E8pu95.28o@rdc.ernet.in>

From: Devin Ben-Hur <dbenhur@egames.com>
To: Michael Krell <mk2h@clove.cs.Virginia.EDU>

[mail&post]
Michael Krell wrote:
> I'm trying to write a regex that will strip out all occurances of the "{"
> character from a string, unless the brace is immediately preceded by a
> backslash.
[snip]
> I'm confused by the second failure case, as illustrated by the code snippet
> below:
> 
> $string="a{{bc";
> print "string is $string\n";
> $string =~ s|([^\\])\{|$1|g;
> print "after substitution, string is $string\n";
> 
> Which prints:
> 
> string is a{{bc
> after substitution, string is a{bc
> 
> Why aren't both braces stripped?
> Can someone explain this?

>>regexs are "greedy".
>>When you're at this point in the match:
>> a{{bc
>> ^
>>the regex /[^\\]\{/ successfully matches (a matches [^\\], 
>>{ matches { ), so the substitution occurs and the /g iterates
>>starting at this position:
>> a{{bc
>>  ^
>>at which point the regex never matches again so you're
>>left with 'a{bc' as a result.

>>I really recommend you read Jeffrey Friedl's book "Mastering 
>>Regular Expressions" for some insight into these kinds
>>of problems.

> Can someone help me with a regex that covers these cases?

>>Here's something I believe will solve your problem:

>>s{(?xg) # extended form, global substitute
>>                # first three cases match stuff we want to keep
>>    ([^\\\{]+)  #  $1 gets one+ non-special-chars
>>    |           #   or
>>    \\(\{)      #  $2 gets \-escaped lbrace w/o \
>>    |           #   or
>>    (\\.)       #  $3 gets \ followed by any char
>>    |           # or the one case we want to eliminate:
>>    \{          #  a literal lbrace (not in parens, so trimmed)
>>}{$+}; # replace with last matched () group (nil if last case)

Possible Solution:
------------------

here is one of the possible solution,

$answer = 'aaa{\{{{\\{{{\\{';
$question = $answer;
$answer =~ s!(\\{)|{!$1!g;
print "\n $answer \n $question";
 
$ aaa{\{{{\\{{{\\{
$ aaa\{\\{\\{

(himanshu@indiaworld.co.in)
(http://www.indiaworld.co.in)
-- 

                       ^^^^^^^^      
             	      (  o   o )      
		     (     ^    )   


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 313
*************************************

home help back first fref pref prev next nref lref last post