[10978] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4578 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 7 23:07:20 1999

Date: Thu, 7 Jan 99 20:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 7 Jan 1999     Volume: 8 Number: 4578

Today's topics:
    Re: Absolute Yuck <toddl@SiTera.com>
    Re: Absolute Yuck (Andre L.)
    Re: Absolute Yuck (brian d foy)
    Re: background server (Mjd440)
    Re: copying complex hashes <jdf@pobox.com>
        Dos clear screen. <jgiles@wts-tape.com>
    Re: Dos clear screen. <rra@stanford.edu>
    Re: geting arguments (brian d foy)
        Help!  Couldn't spawn child process: <cpu2000@nwcis.com>
    Re: How can i undefine hash elemnt of hash table with k <jdf@pobox.com>
    Re: messageboard <jdf@pobox.com>
    Re: Need CGI database <rob@webteacher.com>
    Re: NT User Admin Script <xldrigxgerx@olexmiss.xedu>
    Re: Perl Criticism <uri@ibnets.com>
    Re: Perl Criticism <tchrist@mox.perl.com>
        Perl on Apache 1.3.3 running on Windows 95/NT <admin@nwcis.com>
    Re: Perl uses in NT <zenin@bawdycaste.org>
    Re: Perl uses in NT <xldrigxgerx@olexmiss.xedu>
        Someone asked how to capitalise first letter of each wo <andrew@geac.co.nz>
    Re: Someone asked how to capitalise first letter of eac (Matthew Bafford)
    Re: Someone asked how to capitalise first letter of eac (brian d foy)
        Sorting by 2 fields <rob@webteacher.com>
    Re: Sorting question <uri@ibnets.com>
        Web page lay out module <zhangh@corp.earthlink.net>
    Re: what's with all the job posts? (John Stanley)
        Wish to create a DBD module to interface with DBI. Wher <CLavy@via-net.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 07 Jan 1999 19:55:35 -0700
From: Todd LaWall <toddl@SiTera.com>
Subject: Re: Absolute Yuck
Message-Id: <369573A7.DE35FB1D@SiTera.com>

JTJ wrote:
> 
> &ReadParse;
>                 open(HTMLFILE,"<$datafile");
>                 @inputData=<HTMLFILE>;
>                 close(HTMLFILE);
> $1 = @inputData;
> $1 =~ s/[TypeOfCard]/$in{'TypeOfCard'}/go;

Hmmmm, you can't do this, and I see another problem with what you've
coded.  You are trying to do a substitution on the $1 variable,
which another poster already stated is a reserved variable, but it
is also in how you are assigning a value to the $1 variable which 
bothers me.  See, the only value you would have in the $1 variable
would be an integer, since you are not specifing a specific element
of the @inputData array.  When you do an array to scalar assignment,
like what you've done, you only get the number of elements in the 
array assigned to the scalar.

Besides this, there is one more error with your code: your sub regex
isn't going to work the way you want, since it is not quoting those
square brackets.  What your regex is currently trying to match is 
a character class which contains the letters "T, y, p, ...".  What you
need to do in this case is have it look something like this:

$var =~ s/\[TypeOfCard\]/$in{'TypeOfCard'}/go;

> I want to substitute the text "[TypeOfCard]" for what I input from html

What you might want to do as an easier way of applying this regex to 
the whole file is to do something like this:

	{
		local($/) = undef;
		open(HTMLFILE,"<$datafile");
		$inputData=<HTMLFILE>;
		close(HTMLFILE);
		$inputData =~ s/[TypeOfCard]/$in{'TypeOfCard'}/go;
	}

This will temporarily undef the input record separator variable ($/, 
which specifies as a default using '\n' as the way to tell when to 
stop reading from a file handle), and causes the whole file to be
read into the scalar $inputData.  Then you don't have to iterate
over each of the elements to match the pattern in the whole file.
The g flag at the end of the pattern match will do it's business,
and you now have a changed file.  Should you now need it in an
array, just split on the newlines.

Hope this helps,
Todd


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

Date: Thu, 07 Jan 1999 22:13:00 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Absolute Yuck
Message-Id: <alecler-0701992213000001@dialup-709.hip.cam.org>

In article <x3yogodle3b.fsf@tigre.matrox.com>, Ala Qumsieh
<aqumsieh@matrox.com> wrote:

> alecler@cam.org (Andre L.) writes:
> 
> > 
> > In article <368AE152.5F89@erase.callisto.si.usherb.ca>,
> > elssa09@erase.callisto.si.usherb.ca wrote:
> > 
> > > $1 = @inputData;
> > > $1 =~ s/[TypeOfCard]/$in{'TypeOfCard'}/go;
> > > 
> > > I get this error message:
> > > Modification of a read-only value attempted at postcard.pl line 23.
> > > 
> > > 23:             $1 = @inputData;
> > > 
> > 
> > The main problem here is assigning a whole file to a scalar. Here's a
> 
> Don't be silly! A scalar can be as large as your memory allow it to
> be. That is not the problem here.
> 
> The problem is assigning to $1 which is a reserved variable. You can't
> assign to ${\d}. Use other variable names.

That is true. But if I didn't mention the problem regarding $1, it was
because a dozen people already had, and it would have been pointless to
repeat it. You have to read a post in the context of the thread.

I was making the point that the poster needed to find some way of getting
his text into a scalar variable before doing a substitution on it. Merely
replacing $1 by $anything would not do anything useful (though the code
would compile ok, I give you that).

Andre


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

Date: Thu, 07 Jan 1999 22:50:56 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Absolute Yuck
Message-Id: <comdog-ya02408000R0701992250560001@news.panix.com>

In article <369573A7.DE35FB1D@SiTera.com>, Todd LaWall <toddl@SiTera.com> posted:

> JTJ wrote:

> > $1 = @inputData;
> > $1 =~ s/[TypeOfCard]/$in{'TypeOfCard'}/go;
> 
> Hmmmm, you can't do this, and I see another problem with what you've
> coded.  You are trying to do a substitution on the $1 variable,
> which another poster already stated is a reserved variable, but it
> is also in how you are assigning a value to the $1 variable which 
> bothers me.  See, the only value you would have in the $1 variable
> would be an integer, since you are not specifing a specific element
> of the @inputData array.

careful now - one cannot assign to $1.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: 8 Jan 1999 02:57:13 GMT
From: mjd440@aol.com (Mjd440)
Subject: Re: background server
Message-Id: <19990107215713.12044.00007856@ng123.aol.com>

Hi,

Try the NT resource kit... it's got a utility in there that will allow you to
run a batch job as a service.  You should be able to get you Perl program
running as a service with that (sorry, the name escapes me, but it's something
like AutoNTExt).  I hope that helps.

-- Mark


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

Date: 08 Jan 1999 04:36:05 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: lori@cse.ucsc.edu (Lori Flynn )
Subject: Re: copying complex hashes
Message-Id: <m33e5mo2qi.fsf@joshua.panix.com>

lori@cse.ucsc.edu (Lori Flynn ) writes:

> print("value is $Hash->{sourceDestPairs}{first} \n");

Okay, so $Hash->{sourceDestPairs} is a reference to a hash.

> %copiedInfo = ();

And %copiedInfo is a hash.

> %copiedInfo = $Hash->{sourceDestPairs};

Erk!  That thing on the right is a *reference to* a hash, not a hash.
If you turn on the -w switch, you'll be warned about that.

   Odd number of elements in hash assignment at yourscript line foo.

To copy the hash referred to by that reference, you must dereference
it:

   %copiedInfo = %{$Hash->{sourceDestPairs}};

And since we're talking about references, this is a good time to
mention your perl reference...

   $ perldoc perltoc
   $ perldoc perldata
   $ perldoc perlref
   $ perldoc perllol
   $ perldoc perldsc

> 2)I'm confused about the difference between using the arrow (as in
> above example) to reference a hash field and other times in my Perl
> book where fields are referenced without an arrow (ie something like
> $Hash{sourceDestPairs} ).  Does this have something to do with
> pointers?

You need to go read about the pointer-like Perl things called
references.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Thu, 7 Jan 1999 17:39:47 -0500
From: "Jason Giles" <jgiles@wts-tape.com>
Subject: Dos clear screen.
Message-Id: <92732980F8282FAE.2C6D9E3012D67252.419A9082AD88830C@library-proxy.airnews.net>

This is a simple issue I know but I am having trouble with it nevertheless.
Does anyone know how to issue a clear screen code to Dos? I have tried
print `cls` and print qx(cls) but that returns gibberish and does not clear
the screen.  Thanks!!

-Jason
jgiles@wts-tape.com




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

Date: 07 Jan 1999 19:17:16 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Dos clear screen.
Message-Id: <yl90fejvwj.fsf@windlord.stanford.edu>

Jason Giles <jgiles@wts-tape.com> writes:

> This is a simple issue I know but I am having trouble with it
> nevertheless.  Does anyone know how to issue a clear screen code to Dos?
> I have tried print `cls` and print qx(cls) but that returns gibberish
> and does not clear the screen.

Try just doing:

        system 'cls';

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Thu, 07 Jan 1999 22:51:35 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: geting arguments
Message-Id: <comdog-ya02408000R0701992251350001@news.panix.com>

In article <36952702.1F555771@euhost.com>, Matevz Sernc <euhost@euhost.com> posted:

> I want that some user click on following link: 
> http://www.domain.xyz/cgi-bin/here.cgi?user=mk10

> How can i get the part after the "?" in a variable in here.cgi ??

use CGI;

the docs have the details.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Thu, 07 Jan 1999 22:47:09 -0600
From: Steve Shawl <cpu2000@nwcis.com>
Subject: Help!  Couldn't spawn child process:
Message-Id: <36958DCD.72BC3819@nwcis.com>

I just figured out how to get perl to run in NT but now I get a
"couldn't spawn child process: d:/servers/inetpub/cgi-bin/test.cgi"
error. Any Ideas???? Please help!
Steve



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

Date: 08 Jan 1999 04:54:10 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Aleksey Zvyagin" <zal@rest.ru>
Subject: Re: How can i undefine hash elemnt of hash table with key ?
Message-Id: <m3ww2ymnbx.fsf@joshua.panix.com>

"Aleksey Zvyagin" <zal@rest.ru> writes:

> undef $hash{'alex'}
> then i am expecting that keys %hash will be ('bob')

   $ perldoc -f delete

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 08 Jan 1999 04:53:01 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "robin" <vdweiden@casema.net>
Subject: Re: messageboard
Message-Id: <m3zp7umndu.fsf@joshua.panix.com>

"robin" <vdweiden@casema.net> writes:

> I was wondering somebody can tell me how to create a simple messageboard.
> I mean just a normal page with links thats\ link to that message
> and buttons
> -post new message
> -reply
> 
> is that a hard thing?

I was wondering if anyone could tell me how to write a simple song.

I mean just a normal song with lyrics that refer to things and ideas.

Is that a hard thing?

(The serious answer: you'll need to learn a bunch of things about:
HTTP; HTML; the quirks of your particular web server; your languages
of choice (Perl and JavaScript are good to know for the web biz); your 
development OS of choice; your text editor and/or IDE; algorithm
design and analysis; organic chemistry (just kidding)...

In other words, how hard and for whom?

You can find many pre-rolled scripts that will do some larger or
smaller subset of what you want done, but if you want exactly what you
want you've got to roll your own or ask someone else to do it.

I'd encourage you to start learning some of those things, because it's 
fun stuff to play with.)

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Fri, 08 Jan 1999 02:26:28 GMT
From: Robert Young <rob@webteacher.com>
Subject: Re: Need CGI database
Message-Id: <36956A90.A2EB83CD@webteacher.com>

Try Webteacher's Webdata;
http://www.webteacher.com/webdata

It self installs on Unix or NT web servers, it can be completely customized
to match your site, and all record, field, and member administration can be
done with a web browser.  You can also import/export from delimited text
files, and it automatically displays images and links.

philipbrown@my-dejanews.com wrote:

>     Does anyone know where I can download a database which
> will allow people to upload their names, addresses, phone
> numbers, etc to a web site and also allow them to view
> the names, addresses, etc of other people who also uploaded
> this information?  It can use CGI for the server side.
>
>                                                    Philip
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own



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

Date: Thu, 07 Jan 1999 21:03:21 -0600
From: Les <xldrigxgerx@olexmiss.xedu>
Subject: Re: NT User Admin Script
Message-Id: <36957579.D4E656AD@olexmiss.xedu>

lchuck@home.com wrote:
> 
> Hello to all.  I am an intern in a large company and I am desperately trying
> to fight my way up the corporate ladder.  What I am attempting to do is to
> find or write a script in Perl that can create, copy, and manipulate users in
> our Windows NT domain.  It would need to be able to accept input, in the form
> of a name, and then find out it that name already exists and if it does, put
> a number after the user name in order to make it unique.  Can anyone tell me
> if something like this exists or at least tell me which modules to use.  If
> it does not exist, I will write/develop it, as I learn Perl, and then post it
> for anyone to use if they wish.  Thanks a bunch.
 

  I am currently working on an app that will create a single user
(adding lists of
users isn't necessary for my needs, but will be added later) with a ptk
GUI interface 
and it has several configurable defaults (more to be added later).
  I am integrating it with another app I've been working on which will
currently search
for a user and display much information and display all users of any
chosen group on the
domain.
  This is a project I started because NT's user management tools suck,
but now I am working on
it as my senior project.

Anyone interested can contact me directly. I do plan to release it as
GPL or something when
I get it to a more functional point.

Les Driggers
ldrigger@olemiss.edu


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

Date: 07 Jan 1999 21:07:00 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: Perl Criticism
Message-Id: <39emp65xh7.fsf@ibnets.com>


thanx tom.

i was waiting for someone like you to rip that drivel to
shreds. i was snickering as i read his page. he has some strange ideas
about functions being the end all. he should do lisp for a living then.

as you said, no more to be said.

another perl hater bites the dust.

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: 8 Jan 1999 01:51:42 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Criticism
Message-Id: <773obe$c0d$1@csnews.cs.colorado.edu>

In comp.lang.perl.misc, the oxymoronically named topmind@technologist.com
mumbles:

:You have not pointed out a single factual error on my part. (I am sure they
:exist, but not rampant.)
:
:Keep trying.

That's it.

This is my first -- and my last -- word on the matter.

> Most of the popular scripting languages 

Mistake number one: your tacit assumption that such a thing as a
`scripting language' exist.  It does not.  Programming is programming.
I'm nearly certain that you aren't discussing scripting the dialogue
between a set of cooperating agents, such as we see in uucp or ppp chat
scripts.  And even if you are talking about that, Perl has no formal
syntactic constructs delineating who's telling whom what.  

Since you don't seem to understand what a script is, 
permit me to demonstrate a few.  Here's one:

    chat -v                                            \
        TIMEOUT         3                               \
        ABORT           '\nBUSY\r'                      \
        ABORT           '\nNO ANSWER\r'                 \
        ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
        ''              \rAT                            \
        'OK-+++\c-OK'   ATH0                            \
        TIMEOUT         30                              \
        OK              ATDT$TELEPHONE                  \
        CONNECT         ''                              \
        ogin:--ogin:    $ACCOUNT                        \
        assword:        $PASSWORD

And here's another:

     expect {
	 busy               {puts busy\n ; exp_continue}
	 failed             abort
	 "invalid password" abort
	 timeout            abort
	 connected
     }

Perl is not what on these languages.  When all is accounted for, Perl
remain a general-purpose programming language, just as BASIC, lisp,
scheme, modula, algol, guile, icon, pascal, python, C, C++, and java are.
I'm not saying they're the same languages, but that they share with perl
a generality that is not to be found in these actor-puppet languages
such as I have demonstrated above.

> were built with poor research

Pardon me, but your unfounded accusations of `poor research' on the
part of these languages' authors is unprofessional in the extreme.
Can you substantiate your claims?  Please list languages, authors,
and your incontrovertible evidence that these authors engaged in 
`poor research'.   Don't forget haskell and dylan.

> or debate about why one approach is "better" than another. 

Ah, you were there, then?  Tell me, what were the discussions that led
up to icon?  What about those from which java sprang?  Those that gave
us ml must have been of particular interest -- might you please recount
these deliberations to us to which you appear to have been uniquely privy?

Perhaps in my advanced years, memory fades, but I for one do not recall
your participation or even observation while Perl was being designed,
particularly the perl of today, which saw its debut in 1993.  Who are
you to say we all had no research, no debate?  I can categorically
state that a good bit of both certainly did occur.  Therefore, you are
factually incorrect.

> The author(s)
> of the scripting languages simply built upon something they were already
> familiar with.

Now, what pray tell is so wrong with laying out a gentle upgrade path?
Would you rather that all artistic creations were created out of the
nothingness?  Do you think people will be able to make good use of
something lacking all resemblance to prior art?

First, you allege that the authors of all these myriad languages ignored
the past, and then without even taking a breath, you say that they did
the very opposite, mindlessly copying existing art.  Which one is it?

> Much of Perl, for example, resembles UNIX scripting languages because that
> is what the author was familiar with. 

It is true that Perl's author was familiar Unix.  But it was neither
his first, nor was it his latest.  From these diverse influences
did he create the Perl we have today.  If you had worked a bit
harder at research, you wouldn't have made such an obvious misstatement.

> UNIX systems have utilities that allow
> extensive commands to be issued on the command line. Since there is only one
> command line, UNIX programmers have a tradition of trying to fit as much on
> one line as possible. 

What a peculiar notion!  `Only one command line'?  What ever does that
mean?  Do you mean that there's only one shell?  Do you mean that a user
can only do one thing at a time?  Do you mean that you can't connect
commands together if they don't fit on one line?  That you can't use
temporary files, variables, named pipes, unnamed pipes, or environment
variables?  That you can't just type things in?  Whatever can you be
talking about?  This makes no sense at all.  I would say, therefore,
that this is yet another in what one shall see to be a long series of
factual errors:  Unix does not `have only one command line'.

> This tends to make UNIX-derived languages, such as
> Perl, a bit cryptic. 

Could you please run through that line of reasoning again?  I'm not
with you.  I assume that the antecedent of `this' must be `only one
command line'.  Once you manage to explain what you are talking about,
you can demonstrate the logic whereby you have arrived at the conclusion
that a command line interface someone implies that the resulting tool
must end up being `a bit cryptic'.

>(Don't get me wrong, Perl is quite powerful, but it
> needs to get away from its command-line roots.)

It does?  And why is that?  And what does it mean?  Where else are we
supposed to go?  Voice control?  Some point-and-drool drag-and-drop
demo to impress the technically incompetent?  Have you really paid any
attention to the power and flexibility granted by a CLI?  Because of
the CLI, we can use simple tools to automate infinite tasks never
considered by those tools' authors.  Combinatorics wins here -- and big.
The simplicity of the interface provides a power that cannot be matched
by dedicated interfaces.  What are we supposed to do?  Create tools
that can only talk to each other because all possible tools that each
would talk to have had their own idiosyncratic interfaces compiled in?
Because of a CLI, Unix is remotely administratable.  Because of a CLI,
Unix can be used remotely -- even administered -- with total transparency.
All these things can be automated.  You don't have to go sit at the toy
computer's console.

I don't think you've spent enough time thinking about this.

> To avoid such narrow-mindedness when the Next Great Scripting Language is

One certainly need not page through the DSM-IV to witness the clear mark
of an expansive personality in action.

[...]

Rather than analyse each of your tired points, I'm going to skip forward
to point out some of your many factual errors.

> Although it is often said that bad programmers can ruin any language, some
> languages are much more abusable than others. To prevent bad or selfish
> programmers from doing too much damage, I propose that a good scripting
> language should be designed such that it is always easy to tell where one
> command/assignment ends and another starts, and easy to tell the
> relationship (if any) between the command/assignments. One way to achieve
> this is to avoid unnecessary deviations from the function rule.

> Thus, you will always know what is a parameter, an assignment, a control
> statement, a function call, etc. The programmer may be able to scramble the
> molecules, but not the atoms.

> Languages like Pascal and Java (non-scripting languages) are examples of
> languages that are the least abusable from this standpoint, while Perl and
> C++ can be notorious in the wrong hands. We will try to reach a good
> compromise here.

There you go again.  Since when did Java become a `non-scripting language'?
And what is C++?  What are you talking about?  

> The amount of readability should be given much thought. Programmers are more
> heavily rewarded for finishing on time than for producing readable code.

Have you ever read about the creation of COBOL?  If you had, the echoes
of those designer's criteria would resonate painfully in your head

> Most languages fit into one of three categories. First, some languages like
> Perl inherit scope automatically. Pascal is a (non-scripting) language that
> allows scope to be inherited only if a subroutine is nested within another.
> We will put Pascal in a second category that requires explicit coding to
> inherit scope, or at least gives both options. C will be in the third
> category of not allowing any inheriting except via global variables and
> parameters.

Either you have a very strange notion of the word `scope' or else
you don't understand Perl at all -- or as I begin to suspect, both.

Subroutines in Perl most certainly do *NOT* `inherit the scope' of
their caller.  The only way that would happen is if the routines were
lexically nested.  You are confusing compile-time scoping issues with
package variables.  If you hadn't done such poor research, perhaps
you wouldn't have made so risible an error.  Before you respond, you
had better go back and learn about scoped variables, closures, package
variables, import/export, modules, and inheritance.  Right now,
you're only embarrassing yourself and wasting our time.

> If you find this a little too formal for a scripting language, 

I sure with you could get off this `scripting language' blather.
It undermines everything you say.

> Many Perl fans argue that much of Perl's potentially cryptic syntax is
> necessary to provide Perl's power. 

We do? I don't recall that.  I recall arguing that someone who 
doesn't know the Greek character set is in no position to complain
that something's all Greek to them.

> First, get rid of "hidden linkers" such as the "@_" operator. 

Yet more factual errors.  When will they ever end?  @_ is not 
an operator.  It is an array.  I suppose that we'd better get 
rid of @ARGV as well.  
And what is this `hidden linker' mumblage?  There's nothing 
hidden at all.  Perhaps you'd prefer that it were called
@My_Variadic_Subroutine's_Current_List_of_Actual_Parameters.

>    replace("ab123ab456", "ab", "xy") // result: "xy123xy456"
>    list = split("123,456,789", ",")  // similar to Perl's Split
>    astring = combine(list, ",")   // opposite of Split
>    trim("  abc  ")   // result: "abc"
>    at("quick brown fox", "brown")  // result: 7 (position 7), zero = not found
>    rat("ababababa","b")  // result: 8; starts search from right
>    empty("   ")   // result: true; returns true if blank or white spaces
>    format(123.12, "######.##")  // result: "   123.12"

You sure you don't like COBOL?

> Here is one function that I wish to promote:
>    AppendLine("filex.txt", astring)
> This would open the given file, write the given line to the end of a file,
> and then close the file. It is one-stop shopping. It is ideal for debugging,
> and could be used for log and trace files. Note that a file handle does not
> have to be tracked. False is returned if there is an I/O error.

Feel free to write it.  Make it a module.  Promote it.  But I'll tell you
this, someone who's too slow to pick up how to open a file, or use "system
echo foo >> file", isn't going to be clever enough to use your module.

> Associative Arrays Versus Tables

> Associative arrays in Perl are indeed a nice feature to have in a language.
> However, they strike me as being a subset of table operations. Tables have
> much more flexibility than associative arrays. For example, they can have
> multiple keys (indexes), non-unique keys, automatic persistence, record
> locking, filtered views, and many other features commonly found in
> relational and SQL-based systems.

More factual errors.  You really have no idea how Perl really works,
do you?  Perl is perfectly happy having multiple values for a given key,
or if you would, non-unique keys.  And automatic persistence through
DBM files has been with us since perl3.  Where did you stop, perl2?

> Some languages make a large distinction between subroutines and functions,
> and others make almost none. In scripting languages we know of no known
> reason to make a large distinction. 

Oh, but in `programming languages', we do?  And who is `we'?  Is this
your extensive research team?  Could we please have their names as well,
along with credentials and a list of their publications?  I'd like
to see the original sources that your team drew its conclusions from.

> A feature unique to scripting languages are the instant or implied formation
> of a new variable. One can suddenly say "x = 5" regardless of whether "x"
> was ever declared.

Unique to `scripting languages'?  Oh, please.  Spare us your factual
errors.  What do you think `IMPLICIT NONE' was invented for?  And if
you don't know the answer, you obviously are guilty of poor research.
Back to the books with you, young man.

And for the record, Perl's `use strict' was invented to service a not
dissimilar need.  Combined with pragmata like use strict, properly
designed modules, lexical warnings, and warning handlers easily provide
all you would want, and more.

> Perl and other languages often use default parameters and results to string
> (link) together commands. We will can this "command piping". However, the
> simplification provided by these constructs does not overpower the risk of
> readability that they cause. One might as well as do something like this:

>     t = somefunc(x)
>     another_op(t)

> This is not significantly more code than:

>     // Perl-like implied piping
>     somefunc(x)
>     another_op()     // operates on the result of prior func.

What are you talking about?  Perl doesn't work like that at all.

    another_op(somefunc(x));

is hardly unique to Perl.  And as for the 

    for (@array) {
	s/foo/bar/g;
	tr[a-z][A-Z];
	print;
    } 

style, perhaps you had better do a little bit of research into the Pascal
with statement, or the sed and awk constructs whence these derive.

In summary, I have two pieces of advice.  

    The first is directed to the the author of this drivel.  Go back and
    *really* learn Perl before you bitch so much, and take the time to
    study the historical antecedents as well.

    The second piece of advice is directed to the readership of this
    newsgroup: ignore this man.  He is an ignorant but prolific troll
    who will suck your time and energy as he responds to anything you
    say with unending streams of spitting and bile so replete with sins
    of orthography that you can see he cares nothing about the quality
    of his writing or his likelihood to persuade.  You will not gain
    nothing by arguing with him.  You will only lose.  Nothing good can
    come of it.  Killfiles were made for a reason.  Use them.  I know
    that I certainly shall.

Good bye, and good riddance.

--tom
-- 
If I had only known, I would have been a locksmith.  --Albert Einstein


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

Date: Thu, 07 Jan 1999 22:04:26 -0600
From: Steve Shawl <admin@nwcis.com>
Subject: Perl on Apache 1.3.3 running on Windows 95/NT
Message-Id: <369583CA.7747A34B@nwcis.com>

Hey!
How do I install Perl on Apache 1.3.3 running on Windows 95/NT?
Where do I get the install file(s)?
Where can I get some help (person, paper, or web site :-)?
Also does anyone know the commands (or where I can get them) that will
allow me to send data to the serial port (preferably rs-232) so I can
control external devices with a web interface?
Thank's
Steve Shawl
cpu2000@nwcis.com
http://www.nwcis.com/steve



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

Date: 08 Jan 1999 02:43:12 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl uses in NT
Message-Id: <915763457.658904@thrush.omix.com>

[posted & mailed]

Mike <mctaylor@primenet.com> wrote:
: Hi, I'm new to the Perl world. My boss, a unix administrator, suggested I
: learn some Perl and apply it to my NT administration. Could anyone show me
: where I could find some good examples or situations where I could use Perl
: in NT?

	Isn't there a book, "Learning Perl on Win32 Systems"?

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Thu, 07 Jan 1999 21:44:51 -0600
From: Les <xldrigxgerx@olexmiss.xedu>
Subject: Re: Perl uses in NT
Message-Id: <36957F33.79DDBB99@olexmiss.xedu>

Zenin wrote:

>         Isn't there a book, "Learning Perl on Win32 Systems"?

Very good book. (As are all of Oreilly's that I've used.)

http://www.oreilly.com/catalog/lperlwin/


Les Driggers


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

Date: Fri, 8 Jan 1999 15:41:37 +1300
From: "Andrew Mayo" <andrew@geac.co.nz>
Subject: Someone asked how to capitalise first letter of each word
Message-Id: <773rpq$534$1@news.akl.netlink.net.nz>

I can't find the posting now, but as a newbie it struck me as an interesting
problem (and raised some issues). The problem was to take something like
'hello there' and turn it into 'Hello There'.

The way I did it was to create a hash which would map either a lowercase
letter or an uppercase letter to the uppercase equivalent (the example below
only defines the hash entries for a, b and c to save space)

Then we look for either a word character after whitespace or a word char at
line start, replacing it with the result of looking up the hash. Since
either $2 or $3 could be non-empty when a match occurs, but not both at
once, we concatenate them to create the hash key.

while (<>)
 {
   # this hash is only the first three letters worth, for clarity and also
due to laziness on author's part
 %ltrs=("A","A","a","A","B","B","b","B","C","C","c","C");
 s/(\s+)(\w)|(^\w)/$1$ltrs{$2.$3}/g;
 print $_;
 }

However this seems inelegant (and I'm quite sure its not bulletproof
either). Using the 'tr' function would be better but I am darned if I can
see how to invoke it from within a regular expression, nor can I call a
subroutine e.g ToUpper, which would convert an input character to uppercase
and return this in the context of the regex. All I've been able to do is
reference a variable.

Of course, we could march through the string using while (/..../) {....} and
do stuff in the block, but this also doesn't seem too elegant. How do you
interpolate a routine's value into the replacement string. It must be
possible if you can substitute a variable?. (or do I need to use a tied
variable, perhaps?).




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

Date: Thu, 7 Jan 1999 22:15:35 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Someone asked how to capitalise first letter of each word
Message-Id: <MPG.10ff4266c055c7f198977a@news.scescape.net>

In article <773rpq$534$1@news.akl.netlink.net.nz>, andrew@geac.co.nz 
pounded in the following:
[snip]

To answer the majority of your questions, look in perlre at the /e 
modifier.

HTH!

--Matthew


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

Date: Thu, 07 Jan 1999 22:49:35 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Someone asked how to capitalise first letter of each word
Message-Id: <comdog-ya02408000R0701992249350001@news.panix.com>

In article <773rpq$534$1@news.akl.netlink.net.nz>, "Andrew Mayo" <andrew@geac.co.nz> posted:

> while (<>)
>  {
>    # this hash is only the first three letters worth, for clarity and also
> due to laziness on author's part
>  %ltrs=("A","A","a","A","B","B","b","B","C","C","c","C");
>  s/(\s+)(\w)|(^\w)/$1$ltrs{$2.$3}/g;
>  print $_;
>  }

are you trying to avoid the /e modifier or the \U?

$\ = "\n";

$_ = "just another perl monger";

s/(^|\s+)(\w)/$1\U$2/g;

print;

$_ = "just another perl monger";

s/(^|\s+)(\w)/$1 . ucfirst $2/eg;

print;

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Fri, 08 Jan 1999 02:09:19 GMT
From: Robert Young <rob@webteacher.com>
Subject: Sorting by 2 fields
Message-Id: <3695668B.E345C4C2@webteacher.com>

Hi;

I went to the FAQs, and I found a very brief example of how to do this,
but I don't understand how to apply it.
Here is the FAQ example of how to sort by 2 fields:

@sorted = sort { field1($a) <=> field1($b) ||
 field2($a) cmp field2($b) ||
 field3($a) cmp field3($b)
 } @data;

Now, here is my routine.  Basically, I have a :: delimited database,
which can be sorted by a user-specified field.  This routine populates a
hash with the field  values as the hash values, and the line numbers as
the hash keys.  In the process, it converts dates to numeric values, and
determines whether to use numeric or alpha comparisons.  Once it sorts,
it replaces the original array with the new sequence.  I realize this
looks a bit clunky, and I will not be at all offended if someone knows a
better way to do this.  The user specified sort field is called
$reportSort (stored as the field number), and the sort order (ascending
vs. descending) is called $reportOrder (0/1).

My question is, how can I use the example from the FAQ above to include
a secondary sort in my routine, for a field specified as $reportSort2 in
the sequence $reportOrder2 ?

If my question is not clear, I have included some examples below.


#PARSE/SORT ROUTINE
if ($reportSort>0) {
  $sortcount=0;
  @temp=();
  $textsort="false";
  %sortarray=();
  foreach (@entries) {
          @data=split(/::/);
          $val=lc($data[$reportSort]);
          if ($val=~/^[0-9][0-9]?\/[0-9][0-9]?\/[0-9][0-9]*$/)
{$val=&datetonum($val)};
          if ($val=~/[a-zA-Z]/) {$textsort="true"};
          $sortarray{$sortcount}=$val;
          $sortcount++;
  };

  if ($reportOrder==1) {$bottom="\$a";$top="\$b"} else
{$top="\$a";$bottom="\$b"};
  if ($textsort eq "true") {$oper="cmp"} else {$oper="<=>"};
  eval('@sortarray=sort {$sortarray{'.$top.'} '.$oper.'
$sortarray{'.$bottom.'}} keys %sortarray;');

  foreach (@sortarray) {push(@temp,$entries[$_])};
  @entries=@temp;
};


===========================
EXAMPLE:

@entries might look like this:

123::Carol::King::123 Main St.::Brighton::VA::54321
124::Eddie::Stoll::4 Burger Rd.::Newton::ME::01332
125::Bruce::Lasling::67 Sturgis Ave::Arlington::VA::56043
126::George::Getty::1 Tombstone Ln.::Burton::ME::01355

If the user chose to sort by State, then by Last name, both in ascending
order:
$reportSort=5;
$reportOrder=0;
$reportSort2=2;
$reportOrder2=0;

After running the routine, the results should look like this:

126::George::Getty::1 Tombstone Ln.::Burton::ME::01355
124::Eddie::Stoll::4 Burger Rd.::Newton::ME::01332
123::Carol::King::123 Main St.::Brighton::VA::54321
125::Bruce::Lasling::67 Sturgis Ave::Arlington::VA::56043
===========================

Many many bows and thanks to the person that answers my question.

Rob




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

Date: 07 Jan 1999 21:21:21 -0500
From: Uri Guttman <uri@ibnets.com>
To: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sorting question
Message-Id: <39d84q5wta.fsf@ibnets.com>

>>>>> "TM" == Tad McClellan <tadmc@metronet.com> writes:

  TM> Ilya (no_spam_ilya@napavlly.rose.hp.com) wrote:


  TM> :        (split(/\s+/,$a))[$key1] cmp (split(/\s+/,$b))[$key1]
  TM> :                             ||
  TM> :        (split(/\s+/,$a))[$key2] cmp (split(/\s+/,$b))[$key2];

  TM> sub by_components
  TM>   {
  TM>      my ($a1, $a2) = (split(/\s+/,$a))[$key1, $key2];
  TM>      my ($b1, $b2) = (split(/\s+/,$b))[$key1, $key2];

  TM>      return $a1 cmp $b1 unless $a1 eq $b1;
     
  TM>      return 0 unless defined($a2) and defined($b2);

  TM>      return $a2 cmp $b2;

both of you should think about some transforms before and after the
sorts. not only will the code be cleaner (IMO) but it will most likely
be faster as all the work will not be redone for each compare. read up
some of the threads on sort over the last few months (look for my name,
larry rosler or john porter) and see soem of the very useful sort tricks
out there. RSN (sometime before the true millennium) we will have an
article on them in TPJ.

a simple ST would put all the appropriate values in LoL and can handle
the missing values for you by subbing in 0 or something that will
return 0 in the compare.

a stringified or packed sort would be very easy to make by joining the
split parts again with null values for the missing ones. the original
value is appended onto the sort string. then you do a
plain sort using the builtin cmp compare and extract the original values
with substr or unpack.

but in general never to large amounts of work in the compare code. it is
slow and messy.

uri


-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Thu, 7 Jan 1999 18:31:39 -0800
From: Hong Zhang <zhangh@corp.earthlink.net>
Subject: Web page lay out module
Message-Id: <Pine.GSO.4.03.9901071828050.711-100000@mhz.it.earthlink.net>


Hi all,

I am looking for a GOOD web page lay out module,
commercial or free. CGI.pm can not be used to gernerate
complex web page. TableLayout is good but not enough.

Any info ? Please reply to zhangh@earthlink.net

Thanks in advance,

Hong
zhangh@earthlink.net




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

Date: 8 Jan 1999 02:11:08 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: what's with all the job posts?
Message-Id: <773pfs$781$1@news.NERO.NET>

In article <fl_aggie-0701990924010001@aggie.coaps.fsu.edu>,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
>+ what would you have used for a subject?
>
>RFD - Request for Discussion

I hope you were being facetious. RFD is the other acronym involved in
official process of group creation.



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

Date: Wed, 06 Jan 1999 05:33:50 -0500
From: Chad Lavy <CLavy@via-net.net>
Subject: Wish to create a DBD module to interface with DBI. Where to start?
Message-Id: <36933C0E.A6FC523@via-net.net>

Hi,

    Does anyone have experience with creating DBD modules that can
interface with DBI?  I would like to create a DBD::Teradata module and
really don't know exactly where to begin.

    I will have to implement the interface using SQL embedded in c.
Does anyone have any suggestions as to where find some good
documentation?  I have looked out on www.hermetica.com/technologia/DBI/
but haven't really found anything that spells out what needs to be done.

Any Help would be appreciated.

Thanks,
Chad



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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 4578
**************************************

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