[13114] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 524 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 14 12:07:17 1999

Date: Sat, 14 Aug 1999 09:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 14 Aug 1999     Volume: 9 Number: 524

Today's topics:
        CGI Help dodli@my-deja.com
    Re: code references to builtin functions (Abigail)
    Re: Conditional Using Regular Expression <Pan@LA-Online.com>
    Re: Data collection (serial ports x2) with catagorisati (Bbirthisel)
    Re: dot is too precious to be only for string concatena (Abigail)
        Error message: comma not allowed in filehandle line 15 neptune19@my-deja.com
        I need a script dodli@my-deja.com
    Re: I need a script (Bill Moseley)
    Re: Known Issues with perl neptune19@my-deja.com
    Re: Looking for gibberish generator <meowing@banet.net>
    Re: Perl Programmers' Web Design "Difficulties" <jeff@webdesigns1.com>
    Re: Perl/TK issues (Donovan Rebbechi)
        printing vars <tfiedler@ptd.net>
    Re: Sendmail parameter FAQ (Bill Moseley)
    Re: Sesssion ID (Benjamin Franz)
    Re: Sesssion ID <uri@sysarch.com>
    Re: This code is killing me!!! Help! (Larry Rosler)
        trim code (Jimtaylor5)
    Re: Trouble getting system to return a value (Larry Rosler)
        Updating Tables using two seperate files <rvdd@iafrica.com>
        Why use comp.lang.python when you've got comp.lang.perl <tismer@appliedbiometrics.com>
    Re: Why use comp.lang.python when you've got comp.lang. <tchrist@mox.perl.com>
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Perl when we've got Python?! (John Stevens)
    Re: Why use Python when we've got Perl? <tchrist@mox.perl.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Sat, 14 Aug 1999 13:09:04 GMT
From: dodli@my-deja.com
Subject: CGI Help
Message-Id: <7p3ppd$knl$1@nnrp1.deja.com>

Hi, I am using a free script called PointEdit. The scripts allows a
user to change certain parts of an html document through the use of a
browser with forms. When ever I try to use the scripts I am getting the
following error:

syntax error in file /usr/local/etc/httpd/cgi-bin/pointedit.pl at line
121, next 2 tokens "chomp("/<!--.*?PointEdit.*?>/: nested *?+ in regexp
at
/usr/local/etc/httpd/cgi-bin/pointedit.pl line 122.
[Fri Aug 13 17:28:35 1999] access to
/usr/local/etc/httpd/cgi-bin/pointedit.pl failed for 167.206.207.234,
reason: Premature end of script headers

Does anyone know what this error means and perhaps be able to suggest a
way of correcting it.

Thank you


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 14 Aug 1999 10:16:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: code references to builtin functions
Message-Id: <slrn7rb20t.fg0.abigail@alexandra.delanet.com>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCLXXIII
September MCMXCIII in <URL:news:7p1e2m$smt$1@lublin.zrz.tu-berlin.de>:
\\ Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
\\ >Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCLXXIII
\\ >September MCMXCIII in <URL:news:7p1aho$si5$1@lublin.zrz.tu-berlin.de>:
\\ >'' 
\\ >'' Of course you can wrap your trig functions in a hash of anonymous
\\ >'' subs like this:
\\ >'' 
\\ >'' my %trigtab = (
\\ >''   sin => sub { sin shift},
\\ >''   cos => sub { cos shift},
\\ >''   # etc
\\ >'' );
\\ >'' 
\\ >'' Call them via
\\ >'' 
\\ >'' my $some_angle = 3.14159*4/100;
\\ >'' my $func = shift; # shifts @ARGV
\\ >'' 
\\ >'' my $val = $trigtab{ $func}->( $some_angle);
\\ >
\\ >
\\ >What's the purpose of the hash? You get an extra level of indirection,
\\ >more characters to type, and you lose many of the features 'use strict;'
\\ >gives you. 
\\ 
\\ While I'm sure you have a point, I'm not sure I get it.  It's another
\\ way to call builtins by their name given as a string (look, no eval).
\\ And it works fine under strict as far as it goes.

Which part of the following example didn't you understand?

\\ >    my %trigtab = (
\\ >        sin => sub { sin shift},
\\ >        cos => sub { cos shift},
\\ >    );
\\ >
\\ >    # Oops, didn't create.
\\ >    $trigtab {tan} -> ($some_angle);
\\ >
\\ >That gives a runtime error, while the following gives a compile time error:
\\ >
\\ >    $sin = sub {sin shift};
\\ >    $cos = sub {cos shift};
\\ >
\\ >    # Oops, didn't create.
\\ >    $tan -> ($some_angle);
\\ 
\\ Is that the Californian melanoma-be-dammed attitude towards tan?
\\ Who wants it anyway?  But seriously, you lost me here.
\\ 
\\          tan => sub { my $x = shift; sin( $x)/cos( $x) },

Indeed. But somehow, you forgot to define it. Or you typed 'tna'.
What's your point?

\\ but whom am I telling that...


Oh well, perhaps you only have one variable in your programs, %big_hash.




Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sat, 14 Aug 1999 07:54:38 -0700
From: Pan <Pan@LA-Online.com>
Subject: Re: Conditional Using Regular Expression
Message-Id: <37B5832E.46661793@LA-Online.com>

Thanks for your help.  The basic version of the program works correctly
now.  Besides the problem with the regex, I had to fix a minor bug in
the i/o.  Here's the URL if you are interested in seeing a working
version of the program: 

http://www.abendgallery.com/cgi-bin/parsepage.cgi

Ronald J Kimball wrote:
> 
> Pan <Pan@LA-Online.com> wrote:
> 
> > I want to write a conditional using a reg exp that matches 4 constant
> > characters, 4 variable digits, a variable alpha, and '.htm' like so:
> >
> > food1111a.htm
> >
> > Here is the syntax that I'm trying to use:
> >
> >  if ($linkURL =~ /food......htm/i)
> 
> Without seeing the value of $linkURL, it will be impossible to say why
> this is not matching.
> 
> This regex would more closely match your criterion:
> 
> /food\d{4}[a-z]\.htm/i
> 
> But it still won't match if the one you're using doesn't match.
> 
> --
>  _ / '  _      /       - aka -
> ( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
>     /                                http://www.tiac.net/users/chipmunk/
>         "It's funny 'cause it's true ... and vice versa."


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

Date: 14 Aug 1999 14:46:21 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Data collection (serial ports x2) with catagorisation and storage PROJECT
Message-Id: <19990814104621.09616.00001136@ng-bg1.aol.com>

Hi Stephen:

>I am intending to write an application to collect ascii data from
> two serial ports on a IBM PC.

>oh I would like to run the script on either DOS or LINUX PC !!!!!

I hope you mean Windows (95 or above) rather than MS-DOS.
There is essentially no serial port support in the DOS ports of
Perl.  For Win9x/NT/2000, you use the Win32::SerialPort module.
A linux clone of this module exists as Device::SerialPort. Multi-
platform scripts using the two module implementations are
available as "templates".

The rest of you project sounds like "typical Perl".

Good luck, 

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: 14 Aug 1999 10:16:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: dot is too precious to be only for string concatenation
Message-Id: <slrn7rb225.fg0.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXXIII September
MCMXCIII in <URL:news:37b487a4@cs.colorado.edu>:
||      [courtesy cc of this posting mailed to cited author]
|| 
|| In comp.lang.perl.misc, 
||     Ala Qumsieh <aqumsieh@matrox.com> writes:
|| :Don't create a new syntax just for the sake of creating a new
|| :syntax. 
|| 
|| You should go talk to the hookhook people. :-(


Rubbish.


Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sat, 14 Aug 1999 15:40:35 GMT
From: neptune19@my-deja.com
Subject: Error message: comma not allowed in filehandle line 15
Message-Id: <7p42li$qa4$1@nnrp1.deja.com>

I wrote a small Perl script and when run the following message appears:
no comma allowed in filehandle in line 15
The only line of code in my script that has a comma is this one:
print header, start_html;
which I believe is harmless

Can anyone help?


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Sat, 14 Aug 1999 13:55:26 GMT
From: dodli@my-deja.com
Subject: I need a script
Message-Id: <7p3sgc$m9n$1@nnrp1.deja.com>

Hello, can anyone suggest a good perl script that allows updates to a
pre-exisitng web page.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Sat, 14 Aug 1999 07:33:53 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: I need a script
Message-Id: <MPG.121f1e27758584e79896b5@nntp1.ba.best.com>

dodli@my-deja.com (dodli@my-deja.com) seems to say...
> Hello, can anyone suggest a good perl script that allows updates to a
> pre-exisitng web page.

I've heard of something called 'PointEdit'... posted here about 
45 minutes ago.

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Sat, 14 Aug 1999 15:53:06 GMT
From: neptune19@my-deja.com
Subject: Re: Known Issues with perl
Message-Id: <7p43cv$qn2$1@nnrp1.deja.com>

In article <37B05B34.56908569@us.oracle.com>,
  Seshu Adunuthula <sadunuth@us.oracle.com> wrote:
> Are there any resources to check for known issues with perl
> specifically on NT, (Bug fixes between different releases) etc.
>
> I am running into problems with perl on NT. version 5.004_01
> specifically with running shell scripts from within a perl CGI
> script
>
> open (FD, "c:\\temp\\foo.bat | ");
> while (<FD>)
> {
>    print;
> }
>
> The above script worked for most part and failed after a long
> regress. Now perl refuses to execute the command foo.bat and
> I am not sure where to start investigating.
> (Rebooting the @#$% NT is not an option :-(  )
>
> Does perl have any dependencies on any registry variables
> that could potentionally have gotten corrupted during the
> long regress?
>
> thanx
> Seshu
>
>
In my case a small script I wrote for Perl5 running on a Unix platfrom
generated this error message:
comma not allowed in filehandler line 15
my only line of code with a comma was:
print header, start_html;
which seems innocent enough
Can anyone offer an explanation? Thanks
steve@cancun.com.mx


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 14 Aug 1999 10:35:57 -0400
From: meow <meowing@banet.net>
Subject: Re: Looking for gibberish generator
Message-Id: <873dxmo2eq.fsf@slip166-72-251-196.ma.us.ibm.net>

In comp.lang.perl.misc, Kim Eggleston <kim_eggleston@yahoo.com> meowed:

> Meow comp.lang.perl.misc, meow meow David Cassell meow meow meow Meow 
> meow...

I couldn't have put it better myself.

> The brain, even while glancing at something, can fire a warning if it 
> looks fake.  I have found this to be a distracting factor in presenting 
> "fake" body text.  If I could have something that generates more or less 
> "real" speech (even though when actually reading it, it might not make a 
> terrible amount of sense) it would benefit me greatly.

How about fortune files from a UNIX system?  That's real text, and
already split up into neat little chunks for you to easily grab
random, more-or-less coherent snippets (assuming you skip the Zippy
stuff, of course).

You could vary it even more by tapping into the Chatbot::Eliza module.

This could lead to some interesting "dialogue."


[Must... resist.... urge... to... crosspost... to..  'Nose....]


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

Date: Sat, 14 Aug 1999 09:33:00 -0500
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Re: Perl Programmers' Web Design "Difficulties"
Message-Id: <Icft3.3634$eW1.869@nntp0.chicago.il.ameritech.net>

Most programmers either don't care about how a site looks
graphically, don't have the visual design skills or usually
both. A lot who are blessed with visual design skills aren't
good programmers and aren't interested in programming.
Then there are those of us who are kind of stuck in the
middle and aren't exceptional at anything. In my defense
though, sometimes the latter category make the best
all purpose Web designers for small business sites.
--
Jeff Oien, WebDesigns
http://www.webdesigns1.com/

Shawn Grant wrote in message <682t3.48528$U42.82597@news1.rdc1.bc.home.com>...
>I don't mean to make a sweeping generalization, but it
>appears that the more advanced programmers can't seem
>to create attractive web sites. Not that this is an insult...we
>all have our strengths and weaknesses. Maybe it's a left/right
>brain thing. Lets look at some examples:
>
>http://www.stonehenge.com
>http://www.perl.org
>http://www.tpj.com Perl Journal's was simple too, but now it forwards
>to itknowledge.com (who probably staff web/graphic designers).
>http://www.perl.com/CPAN
>
>To be fair, http://www.perl.com looks good, as does
>http://www.activestate.com
>
>Perhaps web design is inversely proportional to programming skill.
>
>Shawn.
>
>
>




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

Date: 14 Aug 1999 09:29:22 -0400
From: elflord@panix.com (Donovan Rebbechi)
Subject: Re: Perl/TK issues
Message-Id: <slrn7rarph.kh7.elflord@panix3.panix.com>

>Have a look at my project-page mentioned below.

THanks ! 

-- 
Donovan


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

Date: Sat, 14 Aug 1999 13:29:11 GMT
From: "ted fiedler" <tfiedler@ptd.net>
Subject: printing vars
Message-Id: <Haet3.6800$e34.180842@nnrp2.ptd.net>

with this:

open(NAS,"names");
open(ACS,"accounts");
open(DBREADY,"> data.mrg");
@name=<NAS>;
foreach $name(@name) {
    if(    /^name/) {
        s/name//;
    }
}
@account=<ACS>;
foreach $account(@account) {
    if(    /^account/) {
        s/account//;
    }
}
print"@name,@account\n";

I am reading from a file that looks like this:

name john doe
name ed doe
name joe doe
account 123
account 234
account 456

in this file there are always the same number of names as accounts
i need my output to look liike this:

john doe,123
ed doe,234
joe doe,456

instead it looks like this:

name john doe
name ed doe
name joe doe
account 123
account 234
account 456




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

Date: Sat, 14 Aug 1999 07:29:22 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Sendmail parameter FAQ
Message-Id: <MPG.121f1d1c72a62e209896b4@nntp1.ba.best.com>

marcza@my-deja.com (marcza@my-deja.com) seems to say...
> Sendmail has several parameters e.g.
> open(MAIL, "|/usr/lib/sendmail -oi -t -odq");
> 
> Is there anywhere in the web a short introduction
> about all possible parameters ?

Did you look in Programming Perl's index? ;)

how about www.sendmail.org.  That's on the web.  I don't know how 
'short' it is, though.

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Sat, 14 Aug 1999 13:32:04 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Sesssion ID
Message-Id: <odet3.757$bZ1.71705@typhoon01.swbell.net>

In article <37b56416@cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc, rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:
>: Benjamin Franz <snowhare@long-lake.nihongo.org> wrote [some benchmarks]
>:> As you can see, none of (Tom, Aggie and Uri's) proposals are faster than the
>:> _original_ code. I (of course ;) ) was able to improve on it slightly.
>:
>:It looks to me like you improved it partly by cheating.  :)  Why is it that
>:every function except yours takes four lines to get to gmtime(), including
>:extra variables and a shift, while your function only uses one line, hmm?
>
>Good catch!

<sarcasm>
 I will remember to complain next time I see benchmarks where the
 benchmarker failed to rewrite submitted code fragments to optimize 
 them better than the original submitter did.
</sarcasm>

Want to see it in tightly benchmarked glory with all the code optimization 
on your proposals that you *DIDN'T* write (You write code fragments - 
I perform the optimization so you can claim credit for optimizations 
you never wrote: Such a deal.) This is running on a much slower machine 
than I used yesterday since the other one is physically turned off and 
a couple of miles away right now.

Benchmark: timing 100000 iterations of benjamin2, empty, fl_aggie, 
           original, tomc, uri1, uri2...
 benjamin2: 45 wallclock secs (42.00 usr +  0.00 sys = 42.00 CPU)
     empty:  2 wallclock secs ( 2.36 usr +  0.00 sys =  2.36 CPU)
  fl_aggie: 59 wallclock secs (46.92 usr +  0.04 sys = 46.96 CPU)
  original: 55 wallclock secs (51.37 usr +  0.06 sys = 51.43 CPU)
      tomc: 57 wallclock secs (52.48 usr +  0.00 sys = 52.48 CPU)
      uri1: 63 wallclock secs (58.62 usr +  0.00 sys = 58.62 CPU)
      uri2: 75 wallclock secs (70.19 usr +  0.00 sys = 70.19 CPU)

Of the proposed routines, only Aggie's and my own update beat
the original's performance. And my own updated one easily beats 
Aggie's: Even _with_ the optimizations taken from my code applied 
to all the others. 

Feel free to come again.

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

my $tick = time;
timethese(100000,{
       'original' => sub { date_cookie('Biida',$tick) },
          'empty' => sub { empty('Biida',$tick) },
       'fl_aggie' => sub { fl_aggie('Biida',$tick) },
           'tomc' => sub { tomc('Biida',$tick) },
           'uri1' => sub { uri1('Biida',$tick) },
           'uri2' => sub { uri2('Biida',$tick) },
      'benjamin2' => sub { benjamin2('Biida',$tick) },
    });

sub empty {
    "Thu, 01-Jan-1990 00:00:01 GMT";
}

sub date_cookie {
    my ($self) = shift;

    my ($tick) = @_;

    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst,
        $month,$wkday);

    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime($tick);

    $wkday = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$wday];
    $month = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon];

    $sec   = "0$sec"  if (length($sec)  < 2);
    $min   = "0$min"  if (length($min)  < 2);
    $hour  = "0$hour" if (length($hour) < 2);
    $mday  = "0$mday" if (length($mday) < 2);
    $year += 1900;
        
    return "$wkday, $mday-$month-$year ${hour}\:${min}\:${sec} GMT";
}

sub fl_aggie {
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(pop);
    $wday = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$wday];
    $mon = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon];

    $sec  = sprintf("%02d",$sec);
    $min  = sprintf("%02d",$min);
    $hour = sprintf("%02d",$hour);
    $mday = sprintf("%02d",$mday);
    $year += 1900;
        
    "$wday, $mday-$mon-$year ${hour}:${min}:${sec} GMT";
}
sub tomc {
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(pop);
    $wday = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$wday];
    $mon = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon];
    for my $value ($sec, $min, $hour, $mday) {
        $value = sprintf "%02d", $value;
    } 
    $year += 1900;
        
    "$wday, $mday-$mon-$year ${hour}:${min}:${sec} GMT";
}
sub uri1 {
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(pop);
    $wday = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$wday];
    $mon = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon];

    ($sec, $min, $hour, $mday) = map sprintf("%02d", $_), $sec, $min, $hour, $mday;
    $year += 1900;
        
    "$wday, $mday-$mon-$year ${hour}:${min}:${sec} GMT";
}
sub uri2 {
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(pop);
    $wday = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$wday];
    $mon = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon];

    s/^(\d)$/0$1/ for $sec, $min, $hour, $mday ;
    $year += 1900;
        
    "$wday, $mday-$mon-$year ${hour}:${min}:${sec} GMT";
}
sub benjamin2 {
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(pop);

    $wday = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$wday];
    $mon = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon];

    sprintf('%s, %02d-%s-%s %02d:%02d:%02d GMT',$wday,$mday,$mon,$year+1900,$hour,$min,$sec);
}

-- 
Benjamin Franz


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

Date: 14 Aug 1999 11:52:36 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Sesssion ID
Message-Id: <x7iu6i4awr.fsf@home.sysarch.com>

>>>>> "BF" == Benjamin Franz <snowhare@long-lake.nihongo.org> writes:


  BF> Ah. But I wasn't benchmarking padding number lists. I was
  BF> benchmarking creating dates for Netscape cookies.

so why did you think we were so dumb as to not use a single sprintf for
that? come on, we all worked on padding 4 separate scalar vars. and your
solution is so obscure that none of us would use it?

  BF> Actually, *they* pulled the four lines out of context of the
  BF> routine.

as is shown here:

from:  Benjamin Franz

               
$sec  = "0$sec"  if (length($sec)  < 2);
$min  = "0$min"  if (length($min)  < 2);
$hour  = "0$hour" if (length($hour) < 2);
$mday  = "0$mday" if (length($mday) < 2);
$year += 1900;

return "$wkday, $mday-$month-$year ${hour}\:${min}\:${sec} GMT"; }

from: I R A Darth Aggie

[just a nit, nothing serious]
                 
+  $sec  = "0$sec"  if (length($sec)  < 2);
+  $min  = "0$min"  if (length($min)  < 2);
+  $hour  = "0$hour" if (length($hour) < 2);
+  $mday  = "0$mday" if (length($mday) < 2);

Methinks this would be more efficient (for some value of efficiency): 

$sec  = sprintf("%02d",$sec);
$min  = sprintf("%02d",$min);
$hour = sprintf("%02d",$hour);
$mday = sprintf("%02d",$mday);


so the padding thread started here. and no one cared about the context
after that. that is what sometimes happens with long threads. it became
about padding vars and not about creating a cookie date.

  BF> The purpose of the routine is to return a date for use in a
  BF> Netscape cookie. As is obvious in the original code. Everyone else
  BF> seems to have lost sight of that goal in favor of worrying about
  BF> how to pad a list of numbers to 2 digits. Which *wasn't* the goal
  BF> - merely a sub-task. Which is also why complaints about
  BF> 'scalablity' etc are badly mis-placed. The routine doesn't need to
  BF> scale to long lists of numbers. It will *never* need to.

so why did you write benchmarks comapring a set of padding tricks to one
that sprintf'ed the cookie? is that fair either? you could have just
stated that earlier or stopped defending your method. anyone would have
agreed sprintf is the right solution for the date problem. you didn't
even use it correctly in your original code so you learned something
from this.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Sat, 14 Aug 1999 08:48:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: This code is killing me!!! Help!
Message-Id: <MPG.121f2fc2e3823afb989e5a@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <37B4A87C.EC39AB90@electron-alchemy.com> on 13 Aug 1999 
16:26:12 PDT, Joby <jsb@electron-alchemy.com> says...
 ... 
> foreach $cida (sort @cids) {
> $totalnum = &counter($cida);
> print "$cida = $totalnum <br>";
> }
 ...
> sub counter {
>   my @results;
>   my $test = 0;
>   open(OFFERDATA,"emailcnt.txt") || die $!;
>     while(<OFFERDATA>){
>       if(/$_[0]/oi){push @results, $test}
                  ^^

Your problem is here.  The /i flag is irrelevant, but the /o flag is 
destructive.  It causes the regex to be compiled the first time it is 
encountered, using the current value of $_[0].

But leave the /o off and you will be recompiling a regex on every line 
of a loop over a file that is being read in its entirety within another 
loop.  To say that this is grossly inefficient would be to understate 
grievously.

Rethink your algorithm!

>     }
>   close(OFFERDATA);
>   $totalnums = @results;
>   return $totalnums;
> }

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 14 Aug 1999 15:31:45 GMT
From: jimtaylor5@aol.com (Jimtaylor5)
Subject: trim code
Message-Id: <19990814113145.15476.00000769@ng-fh1.aol.com>

Newbe question!
This works, but I'm trying to find a simpler way of matching and incrementing
sales, hits, whatever, in each month, without all this embarassingly ugly code.
I've tried and failed. Does anyone know of a better way. The $mon_it variable
being the current month, and the month variables holding the numbers. Help me
or shoot me and put me out of my misery :)


 foreach $month ($line1) {
  if ($mon_it =~ Jan) {
    $jan++;
  }
  elsif ($mon_it =~ Feb) {
    $feb++;
  }
  elsif ($mon_it =~ Mar) {
    $mar++;
  }
 ..etc.
 }
 



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

Date: Sat, 14 Aug 1999 08:00:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Trouble getting system to return a value
Message-Id: <MPG.121f24544bba8a9c989e59@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7p1e13$2kkq$1@grind.server.pavilion.net> on Fri, 13 Aug 1999 
16:34:56 +0100, Andy Holyer <andyh@pavilion.co.uk> says...
> This is almost certainly a RTFM, but I can't see what I'm doing wrong.

Yes, it is an RTFM, but TFM isn't nowhere near as clear as it might be.

> Sorry in advance if this is obvious.

It is once you know, but until then it is a fairly common 'Gotcha!'.

 ...
 
> system "$perl_prog $digest_script $init_file" == 0
>     or die "Can't run the digest program: $!\n";

 ...

> There must be something totally obvious I'm doing wrong. Any hints? I've
> already looked at access permissions etc.

From `perldoc -f system`:

 The return value is the exit status of the program as returned by the
 wait() call. To get the actual exit value divide by 256.

And this is `perldoc -f wait`, in its entirety:

wait

 Behaves like the wait(2) system call on your system: it waits for a
 child process to terminate and returns the pid of the deceased process,
 or -1 if there are no child processes. The status is rketurned [sic] in
 $?. Note that a return value of -1 could mean that child processes are
 being automatically reaped, as described in perlipc. 

Hmmm.  It's even less clear than I thought!  Let's go back to `system`.  
The 'exit status of the program' (unlike the exit status of a system 
call) is 0 on success, nonzero on failure.  So the logic of your success 
test is reversed.

Ouch!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 14 Aug 1999 15:09:52 +0200
From: "Romiko" <rvdd@iafrica.com>
Subject: Updating Tables using two seperate files
Message-Id: <7p3q6v$64a$1@nnrp01.ops.uunet.co.za>


Howzit

I have been trying to write a script that compares two similar files and
updates the changes , I have been trying for two days and cannot get it
right.  FileA is the Table that needs to be updated and fileB is the table
with the latest records.  The third field  in FILEA(cifa) needs to be
compared
with the first field in FILEB(cifb) and the fith field in FileA(Account
number) compared with the 3rd field in FileB (Account Number)to see whether
an existing customer open another account eg had a savings and then opened a
cheque account later.
you will notice that a portion of the account number matches the cif number.

FileA

002233791|10001|7|Romiko van de dronker|021/00007/13
002233792|10001|7|Romiko van de dronker|022/00007/14
002333745|10002|14|Bob Harrison|021/00014/12

FileB

7|Romiko van de dronker|021/00007/13
7|Romiko van de dronker|022/00007/14
8|Michael Bake|021/00008/12
14|Bob Harrison|021/00014/12
16|Harry Ford|429/00016/11
16|Harry Ford|430/00016/12
200|Joe Blogs|021/00200/13
23333|Gary Player|022/23333/45

OUTPUT

002233791|10001|7|Romiko van de dronker|021/00007/13
002233792|10001|7|Romiko van de dronker|022/00007/14
8|Michael Bake|021/00008/12
002333745|10002|14|Bob Harrison|021/00014/12
002543578|10003|16|Harry Ford|429/00016/11
16|Harry Ford|430/00016/12
200|Joe Blogs|021/00200/13
23333|Gary Player|022/23333/45

OUTPUT2 (shows changes only)

8|Michael Bake|021/00008/12
16|Harry Ford|430/00016/12
200|Joe Blogs|021/00200/13
23333|Gary Player|022/23333/45

notice that Harry has opened another
account and his customer number stays the same (16), so the record with the
new account needs to be taken into account.  Guys I have tried using this
script that I made but is does not work, why??

Cut here -------------------

BEGIN { FS = OFS = "|"
while (getline <"A") {

cifa = $3; acca = substr($5, 5, 5)
while (getline <"B") {
cifb = $1; accb = substr($3, 5, 5); name = $2; accfull = $3
}
}
{if (cifb != cifa ||  accb != acca ) {
print cifb, name, accfull
}
}
}

CUT---------------------------------







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

Date: Sat, 14 Aug 1999 15:41:50 +0200
From: Christian Tismer <tismer@appliedbiometrics.com>
To: python-list@cwi.nl
Subject: Why use comp.lang.python when you've got comp.lang.perl.misc?
Message-Id: <37B5721E.D55CEB3F@appliedbiometrics.com>

Dear crossposters,

my apologises for this crosspost.

I believe that people would read comp.lang.perl.[xxx]
if they wanted to do so.

I see that someone of the perl newsgroup managed to
post about 35 messages in just a couple of minutes
both to comp.lang.python and comp.lang.perl.misc .

This is bad manners, both the crossposting, and the
bulk of messages. I don't believe that such behavior
is typical for Perl users, but for sure it is not common
in the Python community. Please let us keep it this
way.

Annoing one's own list is one thing, but why bugging others?

If there were a common interest, things are different.
Why shouldn't two or more language's lists become
constructive and think about a common scripting kernel?
How to avoid to reinvent the wheel? Unfortunately, almost
all crossposted threads turned out to be destructive
bulks of words. How about code instead? This is finally
what we are dealing with.
Can those who speak up please code up as well?

The fact that there are different languages with different
lists tells us that they all are needed. We should accept
this fact and don't try to argue about taste. This is a
person's private decision, and nobody is allowed to tell
me what language I should use without being asked. 
This is usenet but not forcenet.

My proposal for future Mailman development:
Let's implement a feature to automatically reject or
at least require moderator approval for every cross-posted
message.

And I'm not kidding:
--------------------

Tcl, Perl and Python have much differences, but they do
have much in common. Why don't we think of *one* best
way to implement dictionaries, *one* I/O library with
a common interface for all the languages, *one* concept
of persitency, distribution of applications, COM interface,
system access, threading, pattern matching, Unicode support... 
Why must this all be different for every language? 

And how about mixed language application, where different
scripting language is just another plugin
for a common framework?

make-code-not-war - ly y'rs - chris

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home


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

Date: 14 Aug 1999 08:03:12 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use comp.lang.python when you've got comp.lang.perl.misc?
Message-Id: <37b57720@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Christian Tismer <tismer@appliedbiometrics.com> writes:
:I believe that people would read comp.lang.perl.[xxx]
:if they wanted to do so.

I believe that if someone wanted to hear about why Perl was a nasty
language and Python was the cat's meow, that they wouldn't be reading
comp.lang.perl.misc to do so.  Wouldn't you agree?  Nonetheless, certain
members of the Python Mafia seem to have taken it upon themselves to
come over here and do precisely that.

:Annoying one's own list is one thing, but why bugging others?

(FYI: List != Newsgroup)

Can you imagine the uproar if the Perl Mafia were to send in their SWAT
teams against the Python community?  I hope you can see how unpleasant
just two or three of these flaming Python fanatics can make our lives.
We didn't ask them to come here and abuse us.  But they did it anyway.
For the SUPERRIGHTEOUS INDIVIDUALS who have this nasty, irrational,
and pissed-off chip on their shoulders about Perl just because they've
been cursed with script-kiddie code (or coding abiliity) to lean over
from their Python porches to piss on us about Perl is annoying at best.

I don't mean to paint everyone with a broad brush here.  There are
reasonable people on whatever side.  I could name names. :-)  Sadly,
it's the noisy ones you tend to hear from.

--tom
-- 
"Most Non-Unix managers conclude that VI is either extraterrestrial
in origin or was devised by the original Unix developers as part of a
secret communication s code to reach another dimension."
    --Communications Week - July 26, 1993.


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

Date: Sat, 14 Aug 1999 14:57:21 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rb0uh.cf9.jstevens@bamboo.verinet.com>

On 14 Aug 1999 03:36:23 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
>On Sat, 14 Aug 1999 03:08:33 GMT,
>    John Stevens <jstevens@bamboo.verinet.com> wrote:
>>On 14 Aug 1999 02:32:12 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
>>>On 13 Aug 1999 20:04:03 -0700,
>    John W. Stevens <jstevens@basho.fc.hp.com> wrote:
>>>>
>>>>Perl doesn't have lists.  Python doesn't have built-in arrays.
>>>
>>>You should learn some perl you now..
>>>
>>>@array = (1,10,20,30);
>>>$from_list = (1,10,20,30);
>>>$from_array = @array;
>>>print "$from_list\n$from_array\n";
>>>
>>>Will output :
>>>30
>>>4
>>
>>The @ prefix denotes an array.  You, yourself, should learn
>>Perl.  Calling an array a list, doesn't make it one.
>
>Can you read?
>
>Can you see a @ in the following line of code :
>
>$from_list = (1,10,20,30);

Your example included:

@array = (1,10,20,30);
$from_list = (1,10,20,30);
$from_array = @array;
print "$from_list\n$from_array\n";

The line you specify does not contain a list, it contains a
tuple.

>No you can't.  Is there an array in that line of code?

No, and that isn't a list, even if you call it one.  It is a tuple.

>No. Is there a list
>in that line of code?

No, it's a tuple, not a list.

>Yes.

No.  Calling it a list, doesn't make it a list.

To be able to perform operations on the above, you'd have to
assign the values of the tuple to an array.

In which case you'd be performing array operations, not list
operations.

>>Not built in, it doesn't, unless you define array and list as being
>>different words for exactly the same type/class.
>
>I don't think you can get more built in then perl lists.

You get tuples in Perl.  The book calls then lists, but you cannot
perform any of the standard, defined list operations on a Perl
"list".

All "list" operations are performed by shoving "lists" into
array's.

Go ahead, show me a variable that contains a list.  In your
example:

$from_list = (1,10,20,30);

$from_list isn't a list.

>Again I repeat, here is a perl list : ('a', 'b', 'c') or qw(a b c)

Again, you are wrong.  The construct ('a', 'b', 'c') is a tuple.
Perl'ers may call it a list, but how do you perform a an insert
on the above?

You don't.  You copy the contents of your tuple into an array,
then perform array operations on that array.

>>I know Perl.  You need to learn Python.
>
>Did I mention a single bit of python syntax in my post? No. 

So what?  I can still make a comment.  And if you had been
paying attention, you would have realized the context of this
thread.

>What was the point of saying I need to learn Python?

Because, in the words of TC, "Learning is a good thing".

More specifically, had you studied Python, it would have been
clear that what Perl calls a list is more properly refered to
as a tuple.

>You might as well have told me to learn C or Lisp.

Yes.  You should.  Had you learned Lisp, list processing would
be second nature to you, and you would have a clearer idea between
"lists" and "tuples" and "arrays".

>>If @ denotes list, then the following Perl would be illegal:
>>
>>@ary = (1, 2, 3);
>>@ary[5] = "Test";
>>
>>But, obviously, this is not illegal.
>
>@ary[5] is an array slice.

Yes.  So what?

>It is an array. It happens to be an array 
>that constists of only one element.

Again, so what?

>Why would it be illegal?

If @ary were a list, it would be illegal.

>It is just
>the special case of :

Stop.  You are talking about arrays, not lists.  I repeat, if
@ary were a list, the above operation would be illegal.

>@ary[1,2,3,4,5,10,20]
>
>It is an array. Thus it has a @.

Yes.  It is an array, not a list.  Though to be perfectly anal,
it might be best to refer to that as a vector. . . ;->

>>Really?  What is the prefix character that denotes a list?
>
>You can't have a list in a variable.

Correct.  So, Perl does not have lists, it has tuples.

>Again here is a list :
>
>(1,2,3,4,5,6,7,8)

No, that is a tuple.

>push( (1,2,3,4,5), 6); 
>
>This results in an error message, funnily enough the message is :
>Type of arg 1 to push must be an array (not list)

Yes.  But calling a tuple a list (or for that matter, calling an
array a list) does not make it one.

Had that been a real list, and assuming that "push" really means,
append, that should have been legal.

>Still claim perl has no lists?

Yes.

>Of course you know better then perl itself.

In this case, I would say that Perl should use the same terminology
as other fields of study.  So, yes, I would consider that Perl
makes a mistake, calling this a list.

John S.


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

Date: Sat, 14 Aug 1999 15:02:42 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rb18h.cf9.jstevens@bamboo.verinet.com>

On Sat, 14 Aug 1999 07:52:51 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
>John W. Stevens wrote:
>
>>By your reasoning, Perl is very, very inconsistent (since not every
>>data type supports '+').
>
>You're looking for the Holy Grail of orthogonality, again.

No, I'm not.  I was, in fact, pointing out to Tom that his
stance was inconsistent even within Perl.

>Python is
>designed with orthogonality in mind,

No, it was not.  Python was designed to simply and clearly communicate.

Proper use of orthogonality aids in making communications clear.

>[Cute sig snipped.]

John S.

[ "Perl.  A language that looks like a C program that has been
  victimized by line noise!"

  "Yeah!?  You think so!?  Take a look at APL some time!"

  "Oh, I have a Mac at home. . ."
]


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

Date: Sat, 14 Aug 1999 15:10:36 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rb1nc.cf9.jstevens@bamboo.verinet.com>

On 14 Aug 1999 04:08:05 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
>That could simply have been a reference. Or a symbolic reference.
>
>What is fundamental is that a @ tacked on the front indicates that it is an
>array.

:-)

What is so amusing about that, is that you can say that with a straight
face!

:-)

>So given @$fred, even with no knowledge of what that exactly means
>you should be able to tell that it is somehow treating $fred as an array.

No, what any reasonable person would do would be to grab for his
Perl book. . .

>>Yes. . . is it a hash, or a scalar?  If it is a scalar, why
>>is it called dict?  If it is a hash, then why is it prefixed
>>by $?  If this is a reference instead of a scalar, then why
>>doesn't it have it's own special prefix character.  ;->
>
>It's a scalar. It is named dict because TomC called it that.

Yes.  My point exactly.

>It is
>also named that since it is a reference to a hash. I use code like this
>in C quite a bit :

A reference to a hash. . . and yet TC claims that Perl is open to
non-computer scientists.

:-)

Doesn't *ANYBODY* else see the irony in that?

>If you know what it means then why do you continually get it wrong
>throughout this thread?

I don't suppose that you realize that getting wrong simply
proves (and illustrates) my point?

I learned it.  I used it.  I haven't written a new Perl program
in three months.

I come back to it, I get it wrong. . . do you see, yet,
or do you just not get it?

>>You cannot write Perl that resemble Python.  You are required to 
>>use curly braces as block delimiters.
>
>In fact you are not. You are wrong yet again.

Actually, I'm right, and you go on to prove I'm right.

>Here is some code from Damian Conway from the 'Impythonating PERL' thread
>in march.
>
>package impythonate;
>use Text::Tabs;
>my ($active, @bracket) = (0, ('{', ';', '}') );
>sub import
>{
 ^ Look closely. . . see that curly brace?

>And here is his sample code that is now valid perl (although anyone who uses
>it for real code should be killed) :

To late.  You already used a curly brace.  Disproving your point,
in case you hadn't realized it.

John S.


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

Date: Sat, 14 Aug 1999 15:14:28 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rb1uj.cf9.jstevens@bamboo.verinet.com>

On Sat, 14 Aug 1999 12:06:11 +0100, Alex Maranda <amaranda@nospam.com> wrote:
>Sam Holden wrote: 
>Why? You don't happen to hate Pythoneers or Python itself, do you? I've
>actually appreciated the argument from your second post, when you taxed
>the other guy for needlessly questioning your Python knowledge out of
>context.

It was not out of context.

Look at the Subject of this thread. . .

>I fail to see the interesting part in this whole thread, which disturbs
>the habitat of comp.lang.python. I think John Stevens was mistaken to
>bring the discussion over to this newsgroup in the first place.

I didn't bring it over.  I followed it after somebody else started
it, and I only started posting when the FUD started getting thick.

>We don't
 ^^

Whose we?

>have strong feelings about Perl, and don't have plans for world
>domination or anything.

John S.


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

Date: Sat, 14 Aug 1999 15:30:10 GMT
From: jstevens@bamboo.verinet.com (John Stevens)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rb2s2.cf9.jstevens@bamboo.verinet.com>

On 14 Aug 1999 02:55:19 GMT, Eric Bohlman <ebohlman@netcom.com> wrote:
>John W. Stevens (jstevens@basho.fc.hp.com) wrote:
>[quoting someone whose name was lost]
>: > It is wrong from the Larry's principle that things that behave
>: > differently should have different appearances.
>: 
>: Then why doesn't Perl have two different operations for
>: assign/reassign, vs. add to an array?  A tiny little violation of
>: Larry's principles, that.
>
>Nope.  "Behave differently" hear means "accomplish two different tasks."  
>Comparing two strings to see if they're equal lexically is not the same 
>task as comparing two strings to see if they're equal numerically.  

Right.  Do you see what I am saying?  Automatic coercion (from string to int)
created a problem.  The problem was dealt with by making a change that
impacts the language.

As well as providing a huge opportunity for defects, the complexity
of the language was increased.

>Putting a particular value in a particular position in an array that 
>already holds a value *is* the same task as putting a particular value in 
>a particular position of an array that does not yet hold a value; the 
>only difference is in the internal details of how to accomplish it.

Yes, but the context of this was TC's comparison with Python's lists.

For an ARRAY, your argument makes sense.  For a list, it does not,
yet TC was taking Python lists to task for not acting like arrays.

On the other hand, Perl's behavior encourages defects:

$array[$index] = $newWord;

The program ran for a very long time, then the system started thrashing,
then it core dumped.

The value of $index?  Very, very large.  Perl happily tried to allocate
Gigabytes worth of core.

>Of course, the OOically-correct way to handle the string comparisons is 
>to define a base class, ComparableString, and two subclasses, 
>LexicallyComparableSting and NumericallyComparableString, along with 
>polymorphic operators that understand which class they're comparing to 
>and apply the correct comparison method.  But there are cases where you 
>may want to do *both* comparisons on a string,

I would disagree with the last part . . . it makes sense to encode
a number as an ASCII string, then to decode it back to an integer,
but to compare two strings as if they were numbers, again, allows
for far to many defects.

For example (another real bug, here):

$result = $Total / $count;

Generated a division error.  $count contained the string: "Payroll". . .

>and to be OC you then have 
>to cast the string to the appropriate type;

Cast?

>the Perlish way of picking 
>the operator director is IMHO easier and more maintainable; in my 
>experience, heavy casting makes code unreadable.

Casting is a poor idea, I agree.  Explicit conversion, however, is
more maintainable and much easier to use in a way that reduces
defect rates.

John S.


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

Date: 14 Aug 1999 07:31:59 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <37b56fcf@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Friedrich.Dominicus@inka.de writes:
:One personal opinion about Perl and Python. I think they are somewhat
:very similar. 

Indeed.  This reminds me of a remark by Dennis Ritchie:  "People don't
realize that Pascal and C are really the same language, and that there
are a lot of *other* languages out there."

Being exposed to Lisp or Scheme, to ML, and to Prolog can bring this point
of Dennis's--which in a sense echoes your own, or vice versa--into sharp
focus and thereby greatly expand one's horizons, much to the over-all
benefit of the curious programmer.

:Last but not least I think Perl more tightly intervened with Unix, 

Certainly Perl's hooks into Unix are stronger than are its hooks for
proprietary systems from Microsoft, Apple, or the erstwhile DEC, which
even if existent, tend to manifest themselves as add-on modules rather
than as original core functionality.  This of course makes perfect
historical sense, given the natal environment and concomitant problem
domain.

Nevertheless, "Perl: The Programmer's Companion" by Nigel Chapman
(whose ambiguously worded title actually posits Perl as a companion
of programmers) does a commendable job of providing a solid technical
foundation for the language with nary a whit of system-specific arcana.
This small and inexpensive volume (in which I aver no personal interest)
stands head and shoulders above all others as the best introductory Perl
book, especially for real programmers such as yourself.  Script kiddies,
tape operators, and all such ilk occasionally merit other recommendations,
some of which occasionally include rather than a book title something
on the order of, "Hey kid, hurry up with those french fries!" :-)

--tom
-- 
sv_magic(sv, Nullsv, 'B', Nullch, 0);     /* deep magic */
    --Larry Wall, from util.c in the v5.0 perl distribution


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 524
*************************************


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