[11025] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4625 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 12 00:17:22 1999

Date: Mon, 11 Jan 99 21:00:19 -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           Mon, 11 Jan 1999     Volume: 8 Number: 4625

Today's topics:
    Re: $32.00 to order RedHat! <devnull@interlog.com>
    Re: Diff by character? <uri@home.sysarch.com>
    Re: Getting program to restart (HUP) more than once <meowing@banet.net>
        How to edit @INC? <adudzik@geocities.com>
    Re: how to return HTML to a specific frame <flavell@mail.cern.ch>
    Re: perl cgi (win95) doesn't work with CGI.pm <chatmaster@c-zone.net>
    Re: Perl Criticism <mds-resource@mediaone.net>
    Re: Perl Criticism <mds-resource@mediaone.net>
    Re: Perl Criticism <rra@stanford.edu>
    Re: Perl Criticism (Michael Rubenstein)
    Re: Perl Criticism (Michael Rubenstein)
    Re: Perl Criticism <rra@stanford.edu>
    Re: Perl Criticism <rra@stanford.edu>
    Re: Perl Criticism (David Formosa (aka ? the Platypus))
    Re: Perl Criticism <chatmaster@c-zone.net>
    Re: Perl Criticism <chatmaster@c-zone.net>
    Re: Perl Criticism <chatmaster@c-zone.net>
    Re: Perl Criticism (David Formosa (aka ? the Platypus))
    Re: Perl Criticism topmind@technologist.com
    Re: Reading a file problem (Ronald J Kimball)
        regexp across multiple arrays, that aren't alike... (Jim Matzdorff)
    Re: So ... Now what do I do?... <myparu@usa.net>
    Re: split not working... <kwoody@citytel.net>
    Re: Trying to find day of week from date (Ronald J Kimball)
    Re: URGENT: Array of arrays... (Ronald J Kimball)
    Re: Verify an email address (Ronald J Kimball)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 11 Jan 1999 23:18:50 -0500
From: Gordon Blair <devnull@interlog.com>
To: Eirik Johansen <webpages@email.com>
Subject: Re: $32.00 to order RedHat!
Message-Id: <Pine.BSI.3.96r.990111231253.22773A-100000@shell1.interlog.com>

www.cheapbytes.com

rh5.2 on cd for $2.... nifty.  ;^)

ps. get debian, freebsd, they're good too,
perl compiles with no errors, cpan works great,
most everything works flawlessly.

uh, for the cheapest rh5.2, rawrite a floppy and
ftp install it.

On Mon, 11 Jan 1999, Eirik Johansen wrote:

> Date: Mon, 11 Jan 1999 15:16:54 +0100
> From: Eirik Johansen <webpages@email.com>
> Newsgroups: comp.lang.perl.misc
> Subject: $32.00 to order RedHat!
> 
> Hi!
> 
> I'm about to order the RedHat 5.2 distro. I was told that it costs
> $49.95 and thought that was a fair price, but they want to charge $32.00
> for delivery, which I feel is too much!
> 
> I figured that RedHat probably has its office in the US, and I live in
> Norway and that's probably why it cost so much. But they had no other
> delivery options (menaing cheaper ones...)
> 
> Are there any places, say in the UK, that also sell the 5.2 version of
> RedHat or is there another way to order it without having to pay so much
> for the delivery?
> 
> Thanks for your suggestions!
> 
> Regards
> 
> Eirik Johansen
> 
> 
> 



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

Date: 11 Jan 1999 23:57:18 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Diff by character?
Message-Id: <x7u2xxgkb5.fsf@home.sysarch.com>

>>>>> "B" == BERNIEGS  <BERNIEGS@prodigy.net> writes:

  B> old REXX one-liner (couldn't get it into a Perl one-liner without making
  B> it hopelessly un-readable). I've used the algorithm a lot over the years

  B> sub char_diff() {        # Generate character differences
  B>   my ($s1, $s2) = @_;
  B>   my $marks;
  B>                          # Here's a little magic:
  B>   $marks = $s1 ^ $s2;    # XOR the strings bitwise
  B>   $marks =~ tr/\x00/ /;  # Identical chars become blanks
  B>   $marks =~ tr/ /*/c;    # Different characters become asterisks
  B>   return $marks;
  B> }

how about this:

perl -le '$_=shift^shift;tr/\x00\x01-\xff/ */;print "[$_]"' 'foo bar' 'boo farss'
[*   *  **]

or cleaner in a sub (a little shorter than yours):


sub char_diff {

	( my $marks = shift ^ shift ) =~ tr/\x00\x01-\xff/ */ ;

	$marks ;
}

the main point is one tr and not 2. just convert all 0's to spaces and
the rest to * all in one op.

hth,

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 12 Jan 1999 03:32:12 GMT
From: Fluffy <meowing@banet.net>
Subject: Re: Getting program to restart (HUP) more than once
Message-Id: <77efnk$cn5@meow.invalid>

Alastair <alastair@calliope.demon.co.uk> wrote:
> Is my signal handler blocked with the exec?

Yup, I think it was, sort of.  Perl leaves the signal trapped in never-never
land if you exec inside a handler.  Resetting the signal to default or
ignore beforehand, using something like exit(system $0) in there to get a
new process instead of exec'ing, all leave you in the same boat.  Bummer,
eh?

The following version works.  Notice that I have to test *outside* the
handler to see if the signal has been tripped (that gets flagged in the
$HUPPED variable), and then call my exec.  This is probably for the
best anyway, because you get the opportunity to clean up your process
gracefully.  Things that care about signals generally have loops, so this
works out pretty well even if it's less than beautiful.

#!/usr/bin/perl -w
use strict;

my $HUPPED = 0;

$SIG{HUP} = \&huphandler;

my $foo = 0;
print "Beginning...\n";
for (;;) {
   print "[$$] meow ", $foo++, "\n";
   sleep 1;
   if ($HUPPED) {
     print "Yeowch!\n";
     exec $0;
   }
}

sub huphandler {
  $HUPPED = 1;
}

#eof


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

Date: Mon, 11 Jan 1999 20:20:28 -0800
From: Alex Stupakov <adudzik@geocities.com>
Subject: How to edit @INC?
Message-Id: <369ACD8C.7CE9AA5C@geocities.com>

Hello,

I have the ActiveState perl installed on a Windows NT box. I have found
out recently,
that the array @INC, in addition to the right library paths, contains
also an old path,
probably from previous installations of perl. Those directories do not
exist any more.
My question: how can I edit @INC and delete nonexistent paths? Is it
stored in a
config file? I tried to search registry, but could not find anything
similar to those
paths.

Thank you.
Alex.



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

Date: Tue, 12 Jan 1999 04:08:30 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: how to return HTML to a specific frame
Message-Id: <Pine.HPP.3.95a.990112040314.16674B-100000@hpplus01.cern.ch>

On Mon, 11 Jan 1999, David Campitelli wrote:

> I am trying to write a script that will update one frame after a form 
> submission has been made in a separate frame.

Then you'd better work out what the server should send to the client in
such a case.  That's not a perl language problem; it would be the same
in principle if you were programming in COBOL. 

> How do I get the script to return the html in the frame that I want.

Write some perl to carry out the non-perl-specific function that we just
discussed.

Frames are spawned from the sewers of Hell, you know.  What are you
_really_ trying to achieve, in terms of a functional requirement?

-- 

                "It's about porting visual design intelligence out of 
                            'design time' into runtime."  -Todd Fahrner




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

Date: Mon, 11 Jan 1999 20:58:20 -0800
From: TRG Software <chatmaster@c-zone.net>
Subject: Re: perl cgi (win95) doesn't work with CGI.pm
Message-Id: <369AD66C.DBC740B4@c-zone.net>


Edwin Litterst wrote:
> 
> A small demo perl script works nice if called from the command line
> but doesn't return anything if CGI.pm is included:
> 
> use Cgi;
> print "Content-Type: text/plain\n\n";
> print "Hello, World!\n";
> 
> The directory which contains the libs is part of the @INC.
> I read the CGI FAQ as well as the Win32 FAQ but nothing seems to
> apply.
> 
> Thanks in advance for every help,
> Eddie

Well, let's see.. 

use Cgi;
OR
use CGI;


print "Content-Type: text/plain\n\n";
Or:
print "Content-type: text/html\n\n"; # It can be plain of course.

print "Hello, World!\n"; #nothing wrong here..

Why are you wanting to use the CGI.pm, when you already have have the
Content-type for a simple print test?

Anyway, you're trying. So next step is to read some documentation, or
some books, or both. O'reilly has very good Perl books, i.e., Learning
Perl, Programming Perl, and the Perl Cookbook. And the documentation
should come with Perl.

There's most likely nothing wrong with the CGI.pm file (unless you
didn't download it right!), it will work on Win95, and you're using it
wrong. If you look in he CGI.pm itself, it will show you a lot.
Good luck...
-- 
Regards,
Tim Greer - chatmaster@c-zone.net
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


       Copyright ) 1999 TRG Software and The Link Worm.


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

Date: Mon, 11 Jan 1999 21:02:12 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Perl Criticism
Message-Id: <369ABB34.16E5B504@mediaone.net>

topmind@technologist.com wrote:
> 
> "There is a saying in the Unix community that one should not prevent idiots
> from abusing something because it may prevent someone else from making good
> use of it. In other words, give everyone chain-saws because (hopefully) more
> people will build useful things than the number who will damage something or
> someone.

In other words, let's take automobiles away until such time as somebody
invents one that won't kill so many people on our highways?

You seem to miss the point of many here: We make very good use of Perl. 
Many of us here who have participated in this thread are living better
today than ever -- and Perl, the status quo and its dialectic,
evolutionary path, has contributed to that.

If you are *not* in that camp, perhaps you will find something else
todo.  Perhaps, you will go live in a box out in the alley . . .

What else can we do?  Do you begrudge us our success ???

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


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

Date: Mon, 11 Jan 1999 21:08:53 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Perl Criticism
Message-Id: <369ABCC5.E477FC71@mediaone.net>

topmind@technologist.com wrote:
> 
> BTW, an equation for a perfect dichotomy is probably not possible

Black & White

Good & Evil

Plus & Minus

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


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

Date: 11 Jan 1999 19:29:58 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl Criticism
Message-Id: <ylr9t1dv7t.fsf@windlord.stanford.edu>

Michael D Schleif <mds-resource@mediaone.net> writes:

> Would you say, therefore, that a subset *is not* a member of any set?

It's certainly a member of a set that contains that set.  But normally the
set {1} is not considered to be a member of the set {1,2}.  It's a member
of the set {{1},{2}}, but that's a different set.  It's a *subset* of the
set {1,2}.

Similarly, 1 is not usually considered to be a set.  {1} is a set
containing 1 as its only element, but things normally do not automatically
become trivial sets.  But this is *really* just a matter of notation, and
it's not that unreasonable to consider 1 equivalent to {1} in practice.
One could argue that 1 is actually {{}} anyway, so it's already a set.  :)

This is all notational, but dropping the distinction between an element
and a subset is a bit unconventional.

-- 
#!/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: Tue, 12 Jan 1999 03:34:58 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Perl Criticism
Message-Id: <369dc29d.91959290@nntp.ix.netcom.com>

On Mon, 11 Jan 1999 20:55:32 -0600, "Michael D. Schleif"
<mds-resource@mediaone.net> wrote:

>topmind@technologist.com wrote:
>> 
>> In article <slrn79ggu1.cjr.dformosa@godzilla.zeta.org.au>,
>>   dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
>> > >
>> > >@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#
>> >
>> > Thats not valid perl.
>> 
>> But I bet it is only a few keystrokes away from being runnable.
>
>Prove it, or shut up }:-^

Only two key strokes are needed to make it runnable:

'@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#'

:-)
--
Michael M Rubenstein


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

Date: Tue, 12 Jan 1999 03:39:49 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Perl Criticism
Message-Id: <369ec3c1.92251630@nntp.ix.netcom.com>

On Mon, 11 Jan 1999 21:08:53 -0600, "Michael D. Schleif"
<mds-resource@mediaone.net> wrote:

>topmind@technologist.com wrote:
>> 
>> BTW, an equation for a perfect dichotomy is probably not possible
>
>Black & White
>
>Good & Evil
>
>Plus & Minus

Useful discussion & this thread.
--
Michael M Rubenstein


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

Date: 11 Jan 1999 19:46:27 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl Criticism
Message-Id: <ylogo5dugc.fsf@windlord.stanford.edu>

topmind <topmind@technologist.com> writes:

> "There is a saying in the Unix community that one should not prevent
> idiots from abusing something because it may prevent someone else from
> making good use of it.

Hm.  That's not quite what I'm saying, and I'm pretty sure that any modern
system administrator would disagree with that phrasing of things.
Obviously security and similar constraints factor in there somewhere, and
I use "use strict" in my Perl code which has precisely this limitation.

I think my personal opinion is more along the lines of "sacrificing
expressiveness for safety is a *choice* and one does not have to make that
choice."  Perl chooses not to make that sacrifice.  Other languages do.
Sometimes I want expressiveness and sometimes I want safety, just like
sometimes I want speed and sometimes I want safety.  I'm glad there are a
variety of languages available so that I can pick the tool I want.

> In other words, give everyone chain-saws because (hopefully) more people
> will build useful things than the number who will damage something or
> someone. However, it is my observation that more programmers are more
> likely to abuse a language than make good use of it.

It's my observation that there are far more programmers in the early
stages of learning their trade than there are experienced programmers.  I
honestly expect this to slowly change over the next decade or so, but only
if we can manage to teach people good habits.  Right now, I'm not sure how
good we are at teaching people good habits.

It's my personal opinion that without good habits, *any* language will be
abused.  Maybe not syntactically, if that's literally impossible, but
semantically, or the algorithms will be poorly thought-out, or the program
will have Y2K problems, or something else will be wrong.  There's just no
substitute for teaching programmers how to program, and once they know how
to program, worrying about enforcing clarity with syntax doesn't really
gain you that much IMO.

> This is usually because the incentive to finish fast is greater (and
> easier to measure) than the incentive to make coherent and maintainable
> systems.

This is a management decision.  Attempting to correct for flawed
management via syntactic decisions in programming languages is, again IMO,
attempting to treat the symptoms rather than the cause.

> In short, I don't trust other programmers any more than I trust
> automechanics. There is no decent feedback loop to punish bad
> programmers who can deliver short-term results at the expense of
> maintanable code.

This is one of the main reasons why I'm a fan of open source software.
There *is* a feedback loop there that doesn't exist in commercial
software.

> Also, I still believe in the idea that 80% of Perl's power can be kept
> without the holes of abusability left in it.

Some of us really like that 20%.  :)

> Some of you are taking this personally.

I'm not. 

> YEOOOOOOOOOWWWWW!

Glad you like my sig.  :)

-- 
#!/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: 11 Jan 1999 19:47:32 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl Criticism
Message-Id: <yllnj9duej.fsf@windlord.stanford.edu>

topmind <topmind@technologist.com> writes:

> How can you say that all languages are *equally* abusable?

That's not what I'm saying.  What I'm saying is that given an experienced
programmer, it really doesn't matter that much, and given inexperienced
programmers, it's noise lost in the other things that will be problematic.

> Do you have any arguments or examples besides an internal opinion?

Mostly just personal experience.

-- 
#!/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: 12 Jan 1999 04:08:51 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn79limj.mtj.dformosa@godzilla.zeta.org.au>

In article <77e6ae$ldp$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <3698f854.191578@news.skynet.be>,
>  bart.lateur@skynet.be (Bart Lateur) wrote:
[...]

>> Anyway, that's how *I* found Perl, Python and TCL, more than 5 years
>> ago. They weren't the "hot items" then. Funny how my preferences of that
>> time eventually made it into popularity...
>>
>> 	Bart.
>>
>
>You should have bought stocks intead, then you would not
>need ANY language :-)

You can buy stockes in perl?


-- 
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html



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

Date: Mon, 11 Jan 1999 20:16:20 -0800
From: TRG Software <chatmaster@c-zone.net>
Subject: Re: Perl Criticism
Message-Id: <369ACC94.57F7CF82@c-zone.net>


topmind@technologist.com wrote:
> 
> In article <yllnjc82hs.fsf@windlord.stanford.edu>,
>   Russ Allbery <rra@stanford.edu> wrote:
> > topmind <topmind@technologist.com> writes:
> >
> > > I challenged someone to show me why Perl's power cannot be cleaned up
> > > without significant (initial) productivity loss.  I have not seen any
> > > yet.
> >
> > Perhaps because many of us believe that, like nearly all programming
> > languages, Perl is as "clean" as the programmer wishes it to be.  You can
> > write clean Perl and you can write obfuscated Perl, things like my sig.
> > My production code doesn't look anything at *all* like my signature, and
> > if someone tried to do something like that in a production script, I'd
> > have a long talk with them.
> >
> > The same is true of most languages.  The dichotomy you're presenting is
> > not one that many of us agree with, so your challenge doesn't mean
> > anything to us.
> 
> From my webpage:
> 
> "There is a saying in the Unix community that one should not prevent idiots
> from abusing something because it may prevent someone else from making good
> use of it. In other words, give everyone chain-saws because (hopefully) more
> people will build useful things than the number who will damage something or
> someone. However, it is my observation that more programmers are more likely
> to abuse a language than make good use of it. This is usually because the
> incentive to finish fast is greater (and easier to measure) than the
> incentive to make coherent and maintainable systems. Thus, I unfortunately
> have to disagree with the "Unix Chain-saw" rule."

So, what you're saying is, your parents only let you play with the
"soft" toys, you road the "short bus" to school, and had the honor of
wearing a "helmet" while sitting at the dinner table? Should we do away
with forks and knifes at the dinner table and revert to only using
spoons?

Careful with the Perl program, you just might put your eye out!
*Anything* in this world can be abused, and if you can't learn to use it
properly yourself, or don't retain the proper comprehension,. then don't
blame us or the language.

'Nuff said!

Tim...


> 
> In short, I don't trust other programmers any more
> than I trust automechanics. There is no decent feedback
> loop to punish bad programmers who can deliver short-term
> results at the expense of maintanable code.
> 
> Also, I still believe in the idea that 80% of Perl's power can
> be kept without the holes of abusability left in it.
> This is my main goal, not to bash Perl. Some of you are
> taking this personally.
> 
> >
> > --
> > #!/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
> >
> 
> ^
> YEOOOOOOOOOWWWWW!
> 
> -tmind-
> http://www.geocities.com/SiliconValley/Lab/6888/
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

-- 
Regards,
Tim Greer - chatmaster@c-zone.net
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


       Copyright ) 1999 TRG Software and The Link Worm.


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

Date: Mon, 11 Jan 1999 20:36:04 -0800
From: TRG Software <chatmaster@c-zone.net>
Subject: Re: Perl Criticism
Message-Id: <369AD134.E00842C1@c-zone.net>



topmind@technologist.com wrote:
> 
> In article <yllnjc82hs.fsf@windlord.stanford.edu>,
>   Russ Allbery <rra@stanford.edu> wrote:
> > topmind <topmind@technologist.com> writes:
> >
> > > I challenged someone to show me why Perl's power cannot be cleaned up
> > > without significant (initial) productivity loss.  I have not seen any
> > > yet.
> >
> > Perhaps because many of us believe that, like nearly all programming
> > languages, Perl is as "clean" as the programmer wishes it to be.  You can
> > write clean Perl and you can write obfuscated Perl, things like my sig.
> > My production code doesn't look anything at *all* like my signature, and
> > if someone tried to do something like that in a production script, I'd
> > have a long talk with them.
> >
> > The same is true of most languages.  The dichotomy you're presenting is
> > not one that many of us agree with, so your challenge doesn't mean
> > anything to us.
> 
> From my webpage:
> 
> "There is a saying in the Unix community that one should not prevent idiots
> from abusing something because it may prevent someone else from making good
> use of it. In other words, give everyone chain-saws because (hopefully) more
> people will build useful things than the number who will damage something or
> someone. However, it is my observation that more programmers are more likely
> to abuse a language than make good use of it. This is usually because the
> incentive to finish fast is greater (and easier to measure) than the
> incentive to make coherent and maintainable systems. Thus, I unfortunately
> have to disagree with the "Unix Chain-saw" rule."

So, what you're saying is, your parents only let you play with the
"soft" toys, you road the "short bus" to school, and had the honor of
wearing a "helmet" while sitting at the dinner table? Should we do away
with forks and knifes at the dinner table and revert to only using
spoons?

Careful with the Perl program, you just might put your eye out!
*Anything* in this world can be abused, and if you can't learn to use it
properly yourself, or don't retain the proper comprehension,. then don't
blame us or the language.

'Nuff said!

Tim...




> In short, I don't trust other programmers any more
> than I trust automechanics. There is no decent feedback
> loop to punish bad programmers who can deliver short-term
> results at the expense of maintanable code.
> 
> Also, I still believe in the idea that 80% of Perl's power can
> be kept without the holes of abusability left in it.
> This is my main goal, not to bash Perl. Some of you are
> taking this personally.
> 
> >
> > --
> > #!/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
> >
> 
> ^
> YEOOOOOOOOOWWWWW!
> 
> -tmind-
> http://www.geocities.com/SiliconValley/Lab/6888/
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

-- 
Regards,
Tim Greer - chatmaster@c-zone.net
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


       Copyright ) 1999 TRG Software and The Link Worm.


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

Date: Mon, 11 Jan 1999 20:44:16 -0800
From: TRG Software <chatmaster@c-zone.net>
Subject: Re: Perl Criticism
Message-Id: <369AD320.7F59EBC2@c-zone.net>



topmind@technologist.com wrote:
> 
> Reply to  TRG Software's chatmaster@c-zone.net 1999/01/08 message:
> 
> So now you are digging into my background in an attempt
> to embarass me. That's right, don't attack the facts and
> issues, attack the PERSON. It is much easier because
> you then don't have to think.
> 
> In my opinion that is f*cking EVIL!!!!!!!!!!
> 
> I hope TRG software and ChatCrap go bankrupt and take you
> spiraling to hell with it !!!!!!!!!
> 
> FU! shatmaster@c-muckhunter.net  !!!!!!!
> 
> You should run for congress. You proved yourself qualified.
> 
> -tmind-
> 

Uh, yeah... If you've been paying attention at all, you'd see that
someone else posted that, and I took a look and clicked on one of the
links, out of curiosity (for jobs) that you posted, and of course, I
felt
it "odd" that you claimed to be an expert in Perl programming, when you
obviously aren't. That's all I said, you wacko... why is that sort
difficult to read? After all, you posted it.

Bankrupt? How can a site that I run for free go bankrupt? You're having
a difficult time dealing with reality here, aren't you?

This is not only foolish of you to say what you are about
the subject you are in this medium. But if you wish to take up any
debate otherwise, then go for it. I'm not attacking you by posting that
humorous garbage you yourself posted, nor am I embarrassing you, as
you're doing fine all by yourself. :-)

This is _very_ off the subject, then again, so is most of everything
else you've been ranting about.
Good day,
Tim... 
PS: "Chat Crap", how old are you?
I'm so happy that I've "gotten to you", it's my pleasure you know.
Now pick on my some more, and call me a "Big stupid head" and be done
with your stupidity, will you!
-- 
Regards,
Tim Greer - chatmaster@c-zone.net
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


       Copyright ) 1999 TRG Software and The Link Worm.


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

Date: 12 Jan 1999 04:40:47 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn79lkif.mtj.dformosa@godzilla.zeta.org.au>

In article <77e6rq$lth$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:

[...]

>It is my opinion that most of the academic types who write
>those papers do very little typical, real world work.

Often they do real world work in some field that your just not falimure with.

[...]

>All knowledge is good, but I still say that the Psycology
>(phonetic: "sykologee") aspect of language design is
>98% of where the problem is.

Rather then psycology wouldn't lingistics be a better field, I mean
they study the way people comminicate.

-- 
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html



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

Date: Tue, 12 Jan 1999 04:48:51 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <77ek7j$1b1$1@nnrp1.dejanews.com>

Reply to David Formosa's 1999/01/09 message:

>> You have ever read the workings of the verious design comminties?
You have ever read the works of Wirth ect?  A starting place would be
"Concepts of Programming Languaeges" by Robert W. Sebesta then read
all the books in its Bibliography. <<

People who have the time to study these 100+ books are
probably PAID to do research. Someone who is paid to do
research is probably not a career programmer in a
fairly typical business setting.

An academic and a career programmer are going to have
a different perspective on what a "good" language
should have. Thus, I might not bring volumes of references
to the discussion, but I can bring real-world experience.

If *you* have read all these, then you are in an ideal
position to start setting me strait.

>> Programers should be the ones who are responable for languge choose
ect.  Mangers are not progrmers they don't program there not experened
in what it is to program, they have no quilifications to judge what is
or is not a good langage. <<

That does not keep them from having influence. Also, the goals
of a programmer may be different than those of a manager.
Programmers may try to engage in "hit and run" programming--
writing cryptic code that only they can figure out to
protect their job. It happens all the time.

Picking between short-term and long-term and between
readability and programming speed are probably the
biggest tradeoffs a programmer is faced with.
The owner's ranking of these will probably be
different that the programmer's, and NOT for
technical reasons.

>> In the case of perl it has borrowed what the
authour considered good ideas from a great number of langues. <<

That is just what I am doing. The only differences is that
I am supplying my reasoning to the public for free so they
can see the criteria, options, and rankings. I am so d*mned
nice! I deserve a hug.....one at a time please, otherwise you might
wrinkle my PriceClub pajamas.

>> the fact that you can't find any of them [books] is not the
fault of these languge designers. <<

Yes it is. They should publish it on the web for free. OCR
the old ones and JPG or GIF the diagrams.

>> The whole of computer science depends in some way or anouther with the
results of one stament effecting enoguther one.  Unix simply exposed
this power to the command line. <<

It is a matter of how, what, and when to extend "this power". BTW,
I am not commenting on Unix, per se, but it's influence on Perl.
What is okay for a command line may not be okay for a language.

>> It just happend to coinedently happened to share a commen scope of the

package main.  If they where in diffrent scopes then they would nosuch effect
<<

Like I said before, "isolate" is a whole lot simpler than using packages
(for our given purpose).

>> They call them thingies because "referant" is to hard to say. <<

It is a book, not a speech. I don't get that argument.

>> I do it quite alot in meny of my programs its quite natural to do. <<

When you get used to something, of course it is "natural" for you.
But there still may be better ways that the next generation should
have the advantage of. Most table work I have seen in Perl
examples was a bit "hacky".

>> [I believe DBM is an *add-on* to Perl, not built into the language.]
You can beleaave what you wish but it doesn't make them truthfull. <<

Is it and add-on, yes or no?

Perhaps the definition of "add-on" is disputable. Anyhow, DB API's
can be added to just about any common language. API's are
just about the worse way to do table stuff, IMO. I do not see
tied DBM as much of an improvement (unless they added stuff
very recently).

>> If you wish relational access in perl you can make use of the
extreemly popular RDBM intterfaces. <<

I don't want interfaces, I want to be *in* the tables. "Interface"
is another word for "afterthought".

>> The use of global vars in any lang are not a good thing.  But this
isn't something unique to perl. <<

But it is *encouraged* in Perl by built-in operations/functions that
are designed to take "advantage" of them.

>> The perl5 archives would be a good place. <<

Let's see if L.Wall considered the same possible variations
that I did. Let's see why he rejected them. Where are
these Perl Archives?

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 11 Jan 1999 22:23:27 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Reading a file problem
Message-Id: <1dlhmdt.1s50i1miwfhwxN@bay2-562.quincy.ziplink.net>

John <John@melon17.freeserve.co.uk> wrote:

> print "Content-type:text/html\n\n";
                     ^^

> I appear to get a malformed header problem.

Yep.  You're missing a space.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 11 Jan 1999 20:05:18 -0800
From: syran@best.com (Jim Matzdorff)
Subject: regexp across multiple arrays, that aren't alike...
Message-Id: <77ehlu$ia1$1@shell18.ba.best.com>

Actually, that's probably not the best title... but it's a start.

I have an array that has 500 string values, let say.  I have another
array that has 1000 string values.

What I want to do, is search the 1000 element array for matches from the 500
element arra.  If a match is found, I will put the matchen array element
from the 1000 element array into yet another array.

on a smaller scale (commas denote array elements in this case):

array1: jack,jill,mike,millie,jeff,gordon
array2: jack is nice, mike is cool, my dog's name is millie, gordon races

The result I want to get would be an array wtih the 1st, 2nd, 4th, and
6th values of array2.

Now I *WAS* using:

foreach (@array1)
{
	push (@new, (grep /$_/, @array2));
}

which worked just fine.  UNTIL i got up to the 500-1000 array values.
things slowed WAYYYYYYYYY down not to mention has the possiblity of
running out of memory (which is understandable).  the question
is, how do i go about speeding things up again.  i am a little bit lost.

and while i have your attention, is there somewhere i can find out a
little bit more about using grep, map, splice, push and etc. for array
manipulation?  I can't find much on perl.com and it still confuses the heck
out of me.

Cheers and thanks,
--jim
-- 
--
One tequila, two tequila, three tequila, floor.


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

Date: Tue, 12 Jan 1999 08:46:42 +0530
From: Murali Ravipudi <myparu@usa.net>
To: euclid <euclid@crl.com>
Subject: Re: So ... Now what do I do?...
Message-Id: <369ABE9A.21F220A5@usa.net>


Do a 
file "perl-5....."
and see if that is an executable, then go ahead and run it.

Murali


euclid wrote:
> 
> I guess THE BIG question is: "What do I do with the file
> 'perl-5.004_04-sol26-sparc-local'?"
> How do I write and execute Perl scripts?
> 
> Lost somewhere in Northern CA.  ;-(
> regards,
> mike anderson


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

Date: Mon, 11 Jan 1999 20:02:01 -0800
From: Keith Woodworth <kwoody@citytel.net>
To: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: split not working...
Message-Id: <Pine.BSI.3.95.990111195711.28966A-100000@rosencrantz.citytel.net>



On Mon, 11 Jan 1999, Bart Lateur wrote:

>>Keith Woodworth wrote:
>>
>>>@_ = grep(/$user/,@_);
>>>print "@_, $user";
>>>($user_name, $total_mins) = split(/\s+/);
>>>print "$user_name, $total_mins";
>>>
>>Because @_ isn't $_ .
>>
>>What do you want, to split one line, or to split each line? I guess the
>>second, but what do you want to do with all the results? You only have
>>room for one.
>>
>>This should get you started (although I personally don't like the use of
>>@_ if not to pass parameters in a sub):
>>
>>	@_ = grep(/$user/,@_);
>>	foreach(@_) {
>>		($user_name, $total_mins) = split/\s+/;
>>		print "$user_name, $total_mins\n";
>>	}

I want to grep for one $user then split the line and printe out $user_name
and $total.

Someone else has pointed out the mistake of $_ and @_. The above is
basically what I had done in antoher small program.

open (FILE,"/var/log/ftp.log") or die "ftp.log: $!\n";
@_ = <FILE>;
close(FILE);

foreach (reverse @_) {
   $count++ if /$anon/;
    next unless /$key/;
    ($month, $day, $time, $host, $daemon, $key, $user) = split(/\s+/);
    printf "%3s  %2d  %10s     %-10s  \n",$month, $day, $time, $user;
}
print "Anonymous Access: $count\n";

As I'm only looking for one line and not doing it with *all* the lines is
where I made the mistake.

Thanks.
Keith



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

Date: Mon, 11 Jan 1999 22:23:28 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Trying to find day of week from date
Message-Id: <1dlhmln.dzztr6vluoteN@bay2-562.quincy.ziplink.net>

Thomas Merlin <antispam@antispam.com> wrote:

> I'm trying to find which day matches a date.
> Example : I have 01/07 in a text file I'm parsing, I'd like to get the
> information that that date is a Thursday.
> 
> I only know how to get the current date's day, not the day of a date I
> give as an argument.
> 
> I know this has to do with timelocal and/or localtime but I'm lost.

You're off to a good start; localtime and timelocal are exactly what you
need.  Let's work backwards from what you want...


How do you get the day of the week for a specific date?

$dow = (localtime($date))[6];


Now, what is $date in the above line?  It's an integer representing the
number of seconds from the epoch.  How do you get the number of seconds
for a specific date?

use Time::Local;
$time = timelocal($sec, $min, $hr, $mday, $mon, $yr);


Now, given that you have the date '01/07' in $_ ...  I'll assume you
want that to be '01/07/Current Year'.

use Time::Local;

$_ = '01/07';

($mon, $mday) = split m{/}, $_;
$yr = (localtime)[5];

$date = timelocal(0, 0, 12, $mday, $mon-1, $yr);
        # use noon just to be safe
        # remember month starts at 0

$dow = (localtime($date))[6];

print "$_ is a ", (qw(Sun Mon Tues Wednes Thurs Fri))[$dow], "day!\n";

__END__


01/07 is a Thursday!


Ta da!

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 11 Jan 1999 22:23:29 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: URGENT: Array of arrays...
Message-Id: <1dlhn6k.1nv8dhw16s7k2uN@bay2-562.quincy.ziplink.net>

The Corruptor <corruptor@terry.org.uk> wrote:

> I'm trying to create an array of arrays, and can't figure out the
> syntax to do so.

Have you looked at perlref, perllol, and perldsc?

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 11 Jan 1999 22:23:30 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Verify an email address
Message-Id: <1dlhn7d.ovpzqdelqj4fN@bay2-562.quincy.ziplink.net>

John Moreno <phenix@interpath.com> wrote:

> Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
> 
> > That's a rather ethnocentric regular expression, wouldn't you say?
> 
> No, it's simply wrong.  There's nothing ethnocentric about that, anybody
> can be wrong (hell, *I* was wrong once).

Yes, obviously.  My point was that one of the ways in which it is quite
wrong is that it only checks for domain names in North America.  [1]
Hence, ethnocentric.


[1] and he forgot .us

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

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

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