[11256] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4856 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 9 15:07:17 1999

Date: Tue, 9 Feb 99 12:00:22 -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           Tue, 9 Feb 1999     Volume: 8 Number: 4856

Today's topics:
        Advance Data Structure Question <gibsonc@aztec.asu.edu>
    Re: Bug and cool debugging technique (5.004_04) (Ilya Zakharevich)
    Re: DBI - Creating an array of results from a query <gary@onegoodidea.com>
    Re: Delete links on virtual server <jjarrett@ecpi.com>
    Re: directory tree dturley@pobox.com
    Re: download file with perl-script <ludlow@us.ibm.com>
    Re: how do I call a perl script from bourne shell <jglascoe@giss.nasa.gov>
    Re: How do I use CGI.pm to fetch parameters? <jjarrett@ecpi.com>
    Re: How do I use CGI.pm to fetch parameters? <emschwar@mail.uccs.edu>
    Re: How long would the Unixes last without Perl? (Walter Tice USG)
    Re: locking files (Tad McClellan)
    Re: Perl 'zine <camerond@mail.uca.edu>
    Re: Perl CGI Script EMails nothing <Tony.Curtis+usenet@vcpc.univie.ac.at>
        please,please,please help me for my sanity. SSI execing <bencas@bigfoot.com>
    Re: please,please,please help me for my sanity. SSI exe <jjarrett@ecpi.com>
    Re: please,please,please help me for my sanity. SSI exe <bencas@bigfoot.com>
    Re: Question: Arrays of associative arrays (Clinton Pierce)
    Re: Renaming filez (Tad McClellan)
        SOCKET of TCP <kcchan@csis.hku.hk>
    Re: Speed of Python <tgm@math.uni-bonn.de>
    Re: Speed of Python <jglascoe@giss.nasa.gov>
    Re: Understanding my <jglascoe@giss.nasa.gov>
    Re: Understanding my <jglascoe@giss.nasa.gov>
    Re: Understanding my <jglascoe@giss.nasa.gov>
        Very Very Newbie- re: perl5.0042-bindist.04bc (ron)
    Re: Would love UNIX program that could read Excel binar <phil@iisc.co.uk>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 9 Feb 1999 12:34:11 -0700
From: "gip" <gibsonc@aztec.asu.edu>
Subject: Advance Data Structure Question
Message-Id: <79q2au$kgv@bmw.hwcae.az.Honeywell.COM>

## I've simplified my problem to the following question:
##
## How can I get the count of the particular number of 'members' in this
structure???
##
##

$structures = {}; # clear structure

%structures = (
      DUMODE_T => {
        structureName => "DUMODE_T",
        size => "16",
          members => [


            name    => "IBIT",
            type    => "enum",
            range   => "",
            default => "0",
            res     => "",
            size    => "4",
          },


            name    => "SBIT",
            type    => "enum",
            range   => "",
            default => "1",
            res     => "",
            size    => "4",
          },


            name    => "DEBUG",
            type    => "enum",
            range   => "",
            default => "2",
            res     => "",
            size    => "4",
          },


            name    => "OPERATIONAL",
            type    => "enum",
            range   => "",
            default => "3",
            res     => "",
            size    => "4",
          },
        ],
      },

      AIRGROUNDLOGIC_T => {
        structureName => "AIRGROUNDLOGIC_T",
        size => "8",
        members => [
          {
            name    => "ONGROUND",
            type    => "enum",
            range   => "",
            rangeLO => "",
            rangeHI => "",
            default => "0",
            res     => "",
            size    => "4",
          },
          {
            name    => "INAIR",
            type    => "enum",
            range   => "",
            rangeLO => "",
            rangeHI => "",
            default => "1",
            res     => "",
            size    => "4",
          },
        ],
      },

      DUIOIPCDISCA_T => {
        structureName => "DUIOIPCDISCA_T",
        size => "8",
        members => [
          {
            name    => "busSelect",
            type    => "uint8",
            range   => "null",
            default => "0",
            res     => "null",
            size    => "1",
          },
          {
            name    => "rawDiscreteIn",
            type    => "uint32",
            range   => "null",
            default => "0",
            res     => "null",
            size    => "4",
          },
          {
            name    => "rawDiscreteOut",
            type    => "uint16",
            range   => "null",
            default => "0",
            res     => "null",
            size    => "2",
          },
        ],
      },
);

    # How to do simple assignments

    $structures{abc}{size} = "123";
    $structures{abc}{members}[0]{name}    = "var a";
    $structures{abc}{members}[0]{type}    = "b";
    $structures{abc}{members}[0]{range}   = "c";
    $structures{abc}{members}[0]{default} = "d";
    $structures{abc}{members}[0]{res}     = "e";
    $structures{abc}{members}[0]{size}    = "f";

    $structures{abc}{members}[1]{name}    = "var 1";
    $structures{abc}{members}[1]{type}    = "2";
    $structures{abc}{members}[1]{range}   = "3";
    $structures{abc}{members}[1]{default} = "4";
    $structures{abc}{members}[1]{res}     = "5";
    $structures{abc}{members}[1]{size}    = "6";

    print "struct:  $structures{DUMODE_T}{structureName}         \n";
    print "name:    $structures{DUMODE_T}{members}[0]->{name}    \n";
    print "type:    $structures{DUMODE_T}{members}[0]->{type}    \n";
    print "range:   $structures{DUMODE_T}{members}[0]->{range}   \n";





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

Date: 9 Feb 1999 18:38:40 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Bug and cool debugging technique (5.004_04)
Message-Id: <79pvbg$ju7$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<ajs@ajs.com>],
who wrote in article <79pjop$9ni$1@nnrp1.dejanews.com>:
> > Why not just run your code under Perl debugger?  It will provide the
> > same info (using basically the same technique).
> 
> Actually, as it turns out, this did not work because the bug does not show up
> under the debugger. I don't know why. In general, the perl debugger tends to
> modify the state of the perl interpreter too much for actuall perl bugs to
> show up in the same way

If you find this, it is a perl bug (unless it is $. or a timing
problem).  You need to report it via usual channels.

Ilya


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

Date: Tue, 9 Feb 1999 19:30:02 -0000
From: "Gary O'Keefe" <gary@onegoodidea.com>
Subject: Re: DBI - Creating an array of results from a query
Message-Id: <79q2cd$ldu$1@plug.news.pipex.net>

I don't think so. The construct is basically an inline push(). The statement
should (it doesn't) fetch a reference to an array holding a result row from
a query and then place it in the next position in the array after the last
value the array currenty holds. It fetches results from the query until
there are no more, $sth -> fetchrow_array returns undef and the loop
terminates. That was the plan anyway (it helps if you don't work from a 2
year old version of the DBI module and Oracle drivers).

Gary

yong wrote in message <36BF6112.E6470BB7@shell.com>...
>If you just want to store the results in @results, why not just
>@results = $sth->fetchrow_array;
>
>Correct me if I'm wrong. I think $results[++$#results] is 1 too many in the
>arrary index. If @results is (1,2,3), ++$#results is 3, not 2.
>
>Yong
>
>Gary O'Keefe wrote:
>
>> while ( @{ $results[++$#results] = \( $sth -> fetchrow_array ) } ) {}
>




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

Date: Tue, 09 Feb 1999 13:57:51 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
Subject: Re: Delete links on virtual server
Message-Id: <36C0852E.84081EF0@ecpi.com>

Did you FTP this script to your server or was it already installed?

If you put it up yourself, just edit it and put it back up. Assuming you
keep the links in the html file itself, search your perl docs for
answers and snippets to write a new section that opens the file,
searches its contents, deletes that line and resaves the file (or
Chapter 8 in Perl Cookbook by O'Reilly, for instance).

Oops, alright, DCLinks keeps it in a separate flat-file database. Shoot,
that's just another text file and makes it easier!

Also, from experience, if you doing a Free For All Links Page and are
getting many hits at all, 99% of the sites fall off the bottom before
they have a chance to go bad. As well as a huge quantity of porno sites
(even if it does have a porno filter) which is why I trashed mine after
I figured out how it worked.

John T. Jarrett



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

Date: Tue, 09 Feb 1999 18:42:17 GMT
From: dturley@pobox.com
Subject: Re: directory tree
Message-Id: <79pvi6$l8o$1@nnrp1.dejanews.com>

In article <36C020CB.E0473F67@logica.com>,
  William Griggs <griggsw@logica.com> wrote:
> Ok, how do I go through a directory tree of unknown structure in Perl,
> putting all files (and their paths) into an array. Any shortcuts?
>
I think the perldoc File::find replies will make it, so I'll just ask, "What,
you didn't buy The Perl Cookbook?"

9.7 Processing All Files in a Directory Recursively

--

____________________________________
David Turley

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


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

Date: Tue, 09 Feb 1999 12:08:49 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: download file with perl-script
Message-Id: <36C079B1.83D7A5CE@us.ibm.com>

Martin Franson wrote:

> I want to download a file from a server from a perl-script on my intranet.
> An example: I want to see if a file called mat.html exist in the dir mfn
> under http://hem.passagen.se
> Is that possible?

Yes, very possible.  The LWP modules will make this task trivial.

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: Tue, 09 Feb 1999 14:38:14 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: mduwjd@maersk.com
Subject: Re: how do I call a perl script from bourne shell
Message-Id: <36C08EA6.2348096D@giss.nasa.gov>

mduwjd@maersk.com wrote:
> 
> how do I call a perl script from bourne shell:
> 

#! /usr/bin/bsh

/usr/local/bin/perl /path/to/myscript.pl

# I guess I don't understand the question,
# this is too trivial right?

> What would be the proper syntax to call perl from bourne and have the perl
> program run concurrently.

hmm.

nohup /usr/local/bin/perl /path/to/myscript.pl &

(or is that just wishful thinking?  :)


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

Date: Tue, 09 Feb 1999 13:32:38 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
Subject: Re: How do I use CGI.pm to fetch parameters?
Message-Id: <36C07F46.8F11B85@ecpi.com>

droby@copyright.com wrote:

> It amazes me that in the same thread we have one poster saying this is an
> appropriate place to ask SSI/CGI questions because we give sensible answers,
> and another poster griping that we don't answer questions.

You'd probably be amazed at how many perl newbies of the category of, oh cool -
we can get data from a form on our website? Oh, it's perl? Well, what else is it
good for? Wow, all that? How do I do that?

And then they (we) sit and monitor the newsgroup gleaning a thing here and there.
Witness the thread "perl 'zine" below. Ton's of people.

And the only people that do give good answers in the CGI group are, guess who -
you guys that stray over there, too.

And did I say thanks to the group for all the collective help? Thanks,
John T. Jarrett



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

Date: 09 Feb 1999 12:41:16 -0700
From: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: How do I use CGI.pm to fetch parameters?
Message-Id: <xkfu2wvjrfn.fsf@valdemar.col.hp.com>

"Sam Schulte" <schultsm@hotmail.com> writes:
> The below should work Jonathan.  Why can't people just answer questions in
> this group instead of all this "go read more" stuff?

Because if they go read more, they'll get better answers than when people 
post misleading or incomplete answers?

> print "Content-type: text/html\n\n";
> print "<HTML><HEAD><TITLE>County Thingie</TITLE></HEAD>\n";
> print "<BODY>\n";

print header,start_html( -title => "County Thingie" );

> print "$county\n";
> 
> print "hello\n";
> 
> print "</BODY></HTML>\n";

print end_html;

Gee, maybe re-inventing the wheel every time isn't a good idea after
all.  Maybe if we referred people to the FAQs and perldocs, they'd learn
better ways to do it.

Naah.

-=Eric


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

Date: 9 Feb 1999 19:46:47 GMT
From: tice@hunch.zk3.dec.com (Walter Tice USG)
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <79q3b7$gvc@zk2nws.zko.dec.com>

In article <ysiemoi0xls.fsf@blkbox.com> Kent Perrier <kperrier@blkbox.com> writes:
>Daniel Grisinger <dgris@moiraine.dimensional.com> writes:

<snips>

>But not in corperate America's defination.  It will not be until I can purchase
>24x7 hardware and OS support from a well known organization.  I cannot even
>bring Linux into my place of work until this option exists.  I can resell 
>Linux to my employer, and charge them $10,000 for an "unlimited" use license
>but it will not be considered until the 24x7 support issue is taken care.
 
>Please, lets not debate over terminology.  I fully support the Open Source
>movement. (Which is why I install the latest perl on every machine I get
>the chance to.  Which is why I am attempting to get Linux in to my 
>organization.)  Until Compaq starts selling and supporting Linux on their
>servers it will not be taken seriously by my management (and, I believe, most
>companies as well).
 
>Kent

Please see: http://www.unix.digital.com/linux/
            http://www.digital.com/alphaserver/linux/index.html

An official statement from COMPAQ dealing w/ Linux support

Hah! Linux on Alpha! Anybody looking for the fastest way to do internet back-bone
or 7x24?? You can't beat it.  

True, COMPAQ is not offering software support, but the hardware is supported.

I missed the beggining of the thread, but, my answer is simple - UNIX/LINUX
will be used in mission critical apps, web oriented apps, and plain old apps
until at least 2038 - take it to the bank!

W

all opinions expressed and/or implied are my own, and have nothing whatsoever
to do with any organization or other person living or dead.



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

Date: Tue, 9 Feb 1999 11:16:26 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: locking files
Message-Id: <ahqp97.7se.ln@magna.metronet.com>

Mike Watkins (mwatkins@promotion4free.com) wrote:

: Basically, once a file is locked no other process can open that file. 


   That is not true.

   It is dangerous to think that.

   Reflect a bit on what the bolded "merely advisory" in the
   perlfunc description of flock() might mean.

   It must have been emphasized for some reason...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 09 Feb 1999 13:25:11 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: webmaster@wondertek.com
Subject: Re: Perl 'zine
Message-Id: <36C08B97.966BD346@mail.uca.edu>

[not followed to clp.modules, more appropriate for clp.misc, IMHO]


"John T. Jarrett" wrote:
> 
> Also, when it came in print, we could have a page for Perl Monger groups and their
> activities; a page for the Perl Institute with current projects, a project
> highlight, and request for project leaders; a sidebar on the future of perl. 
> [snip] 
> Marquis de Carvdawg wrote:
> 
> 
> > A couple of regular sections I'd like to see are:
> >
> > Perl on Unix/Linux
> > Perl on Win32
> > CGI (various platforms)
> > Background info, examples, projects, etc
> >
> > If there is an interest, Perl on other platforms (Mac, etc)
> >[remainder snipped]

(For the record, MdC also said in a previous post:

> Well...I'd like to feature things much the same way as TPJ..and have
> articles for all versions of Perl, not just those on Unix.  I use Perl on
> win32 right now...I'd like to feature system administration scripts,
> etc, for all platforms.  CGI, etc...)

Not to rain on yur parade, but have either of you actually looked at
TPJ, or at least the table of contents (available on the web at
http://www.tpj.com/tpj/contents)? Yes, it only comes out every quarter,
but it has articles about every broad topic in which you are interested
("not just those on Unix") in every issue. 

If there is sufficient interest in things Perlish to support a second
offering in the field, great. But don't justify it by wrongly describing
TPJ as "narrow" (speaking as a Win32 Perlian, myself). And, if you do
decide to embark on such a project, be sure to get help from programmers
of similar stature as those who do have articles in TPJ month after
month.

Cameron
camerond@mail.uca.edu


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

Date: 09 Feb 1999 19:29:27 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Perl CGI Script EMails nothing
Message-Id: <83ww1rctx4.fsf@vcpc.univie.ac.at>

Re: Perl CGI Script EMails nothing, "AE <- )"
<AE@Kline-uk.com>> said:

"AE> #! /bin/perl

perl -w

use strict;

"AE> #This is the sub main part of the script
"AE> %data_in = &Parse_String(); foreach $key (sort
"AE> keys(%data_in)) { $mail .="$key:\n"; foreach
"AE> (split (" : ",$data_in{$key})) { $mail .=
"AE> "$_\n\n"; } } &Email_Str ($mail);
"AE> &ResponsePage;

[snip weird manual extraction of parameters]

I'd use the CGI.pm module if I were you, life will
become much easier.

"AE> alexe\@kline-uk.com\n"; print MAIL "Subject:
"AE> Mail FeedBack\n"; print MAIL "$message \n\n";

There should be a blank line at the end of the
headers.  Using MIME::Tools and Mail::Send would
simplify life for this part.

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Tue, 9 Feb 1999 18:53:36 -0000
From: "el_pollo_diablo" <bencas@bigfoot.com>
Subject: please,please,please help me for my sanity. SSI execing?
Message-Id: <79q08c$fsq$1@news7.svr.pol.co.uk>

Me again! I've written a simple proggie to take a parameter from an SSI call
and output it to HTML. I know the program works because when I call it from
telnet like this : perl -w headlines.pl county=devon I get DEVON written
into the outputted html.

However when I call the SSI using <!--#exec
cmd="/usr/home/allsorts/www/cgi/headlines.pl?county=devon" --> nothing is
output at all. The sheet is blankety blank. However if i remove the
?county=devon bit a text message (jsut something I put in to see if the
thing works) is output.

Does anyone know whats going on. I'm climbing the walls and my cat's getting
scared. hahaha.

--
---
Ben





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

Date: Tue, 09 Feb 1999 13:35:29 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
Subject: Re: please,please,please help me for my sanity. SSI execing?
Message-Id: <36C07FF1.A5B5ED89@ecpi.com>

Did you try the various things in your previous thread? What results and/or
error messages did you get?

If you forgot to check your earlier thread, it is still below with several
solutions offered.

John T. Jarrett



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

Date: Tue, 9 Feb 1999 19:47:00 -0000
From: "el_pollo_diablo" <bencas@bigfoot.com>
Subject: Re: please,please,please help me for my sanity. SSI execing?
Message-Id: <79q3c7$hio$1@news6.svr.pol.co.uk>

Yup I tried the things below. I've replaced the copt of the program with the
one posted. The chap whos made a recent post says that the program works by
using the full url instead of an SSI what does this mean and how do i do it?

Thanks for your help everyone.
---
Ben

John T. Jarrett <jjarrett@ecpi.com> wrote in message
news:36C07FF1.A5B5ED89@ecpi.com...
>Did you try the various things in your previous thread? What results and/or
>error messages did you get?
>
>If you forgot to check your earlier thread, it is still below with several
>solutions offered.
>
>John T. Jarrett
>
>




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

Date: Tue, 09 Feb 1999 17:48:09 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Question: Arrays of associative arrays
Message-Id: <36ca7187.601920721@news.ford.com>

On Mon, 08 Feb 1999 15:26:35 -0600, James Ludlow <ludlow@us.ibm.com>
wrote:
>In the meantime, don't forget that www.perl.com has links to all of the
>Perl documentation and the faq.  In some respects, it's more convenient
>to use than perldoc.  (Still install a full version of perl though. 
>It's a _good_ idea.)

http://www.perl.com is becoming a poorer and poorer Perl Resource
portal than it was.  For example there are no longer pointers to
binary distributions of Perl.  (The development community taking the
holier-than-thou road, according to the distribution page.)  


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

Date: Tue, 9 Feb 1999 11:06:00 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Renaming filez
Message-Id: <otpp97.7se.ln@magna.metronet.com>

=?iso-8859-1?Q?Cyb=EER?= (cybir@echoweb.net) wrote:
: Does anybody know if its possible to rename local files without using
                                       ^^^^^^
                                       ^^^^^^
: system backticks?


   What happened when you searched for that word in the docs
   that came with your perl?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 10 Feb 1999 02:13:09 +0800
From: Rollo Chan Ka Chun <kcchan@csis.hku.hk>
Subject: SOCKET of TCP
Message-Id: <Pine.GSO.4.03.9902100207340.20438-100000@virtue.csis.hku.hk>

I am writing a PERL server which communicates the JAVA client with use of
SOCKET in TCP. I encounter program when sending a binary file. It can be
sent but not the whole file. I think it is related to the buffering of
TCP. Can anyone tell me that how to solve this problem? 

#...bulid up the socket...
    ...
    CLIENT->autoflush(1);
    ...
    # Open the image file.
    open(IMAGE,"< $request");

    # Handle the binary image file.
    binmode(IMAGE);

    # Read the image file and send to the client.
    while (read(IMAGE, $buff, 4096))
    { print CLIENT $buff; }

#problem encounter...can't send the whole file...just partially...the end
#part of the file can't be send..

    # Close the image file.
    close(IMAGE);
    ...
    ...

Thanks for all of your help...

Regards,

Rollo



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

Date: Tue, 9 Feb 1999 20:02:33 +0100
From: Thomas Ackermann <tgm@math.uni-bonn.de>
Subject: Re: Speed of Python
Message-Id: <9o0q97.lk1.ln@final.math.uni-bonn.de>

Greg Ward <gward@cnri.reston.va.us> wrote:
> Bzzzt!  Unfair comparison: you're using a builtin Perl operator for I/O
> versus a couple levels of function call in Python (fileinput.input
> constructs a FileInput instance, then every iteration of the loop calls
> __getitem__ on that instance -- ouch!)  Everybody knows function calls
> are expensive in Python, as they are in Perl.  (Anyone know *which*
> language fares worse for function call overhead?)

> A fairer comparison of execution time would use a less idiomatic but
> more straightforward implementation in each language, e.g.

I've done a bit of these (testing both things seperately):

Perl is over 2 times faster than Python while reading stdin line for line,
while Python is nearly 7 times faster reading the whole input and only
slightly faster than Perl filling a hash-table without any input:

****************************************************************************
Perl                                            Python
----------------------------------------------------------------------------

while(<>)                                       from sys import stdin
{                                               while stdin.readline():
;                                                     pass
}

time perl lines.pl \                           time python lines.py \
  < /usr/dict/words                               < /usr/dict /words

real    0m0.212s ***       < 2.231              real    0m0.473s
user    0m0.210s                                user    0m0.450s
sys     0m0.000s                                sys     0m0.020s

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

@x=<>;                                          from sys import stdin
                                                a=stdin.read()

time perl complete.pl \                           time python complete.py \
  < /usr/dict/words                               < /usr/dict /words

real    0m0.479s           > 6.942              real    0m0.069s ***
user    0m0.400s                                user    0m0.040s
sys     0m0.080s                                sys     0m0.030s

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

$i=100000;                                      i=100000; hash={}
while ($i) { $hash{$i}=1; $i--; }               while i:
                                                        hash[i]=1
                                                        i=i-1

time perl hash.pl \                           time python hash.py \
  < /usr/dict/words                               < /usr/dict /words

real    0m1.392s           > 1.288              real    0m1.081s ***
user    0m1.260s                                user    0m1.020s
sys     0m0.130s                                sys     0m0.060s
****************************************************************************

Man, what are we doing here?!   ;-)

	Byebye,
-- 
  Thomas Ackermann | Tel. +49-(0)228/631369|73-7773 | <tgm@math.uni-bonn.de>
             finger tgm@rhein.math.uni-bonn.de for public key
               GNU LINUX Python gtk pygtk MySQL FUDGE GURPS


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

Date: Tue, 09 Feb 1999 14:33:25 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Thomas Ackermann <tgm@math.uni-bonn.de>
Subject: Re: Speed of Python
Message-Id: <36C08D85.58DDF19E@giss.nasa.gov>

Thomas Ackermann wrote:
> 
> I've done a bit of these (testing both things seperately):
> 
> Perl is over 2 times faster than Python while reading stdin line for line,
> while Python is nearly 7 times faster reading the whole input and only
> slightly faster than Perl filling a hash-table without any input:
> 
> ****************************************************************************
> Perl                                            Python
> ----------------------------------------------------------------------------

<snip>

> 
> @x=<>;                                          from sys import stdin
>                                                 a=stdin.read()

not quite right here.  Python should read "a = stdin.readlines()".
That way both objects, "x" and "a", are lists.  (BTW, I would be
extremely surprised if either language is much faster here: all
the action is taking place at the C level for both.)

> 
> time perl complete.pl \                           time python complete.py \
>   < /usr/dict/words                               < /usr/dict/words

your times are so small, maybe cat "words" together a few times for
a better idea of relative times...

> ****************************************************************************
> 
> Man, what are we doing here?!   ;-)
> 

Dude! we're having fun!  ;)


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

Date: Tue, 09 Feb 1999 13:32:45 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: yong@shell.com
Subject: Re: Understanding my
Message-Id: <36C07F4D.F7EF5726@giss.nasa.gov>

yong@shell.com wrote:
> 
> Programming Perl says "Subroutines called from within the scope of such a
> private variable cannot see the private variable unless the subroutine is also
> textually declared within the scope of the variable." But why does the code
> below print a my variable correctly?
> 

<snip>

you're passing "a" as an argument to the subroutine.

# try this:

$a = "BIZ";

sub main
{
	my $a = "FOO";
	mysub();
}

sub mysub
{
	print $a, "\n";
}

# then a call of "main()" will print "BIZ",
# the global value of "a".


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

Date: Tue, 09 Feb 1999 13:30:56 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: yong@shell.com
Subject: Re: Understanding my
Message-Id: <36C07EE0.D35139C3@giss.nasa.gov>

yong@shell.com wrote:
> 
> Programming Perl says "Subroutines called from within the scope of such a
> private variable cannot see the private variable unless the subroutine is also
> textually declared within the scope of the variable." But why does the code
> below print a my variable correctly?
> 

<snip>

you're passing "a" as an argument to the subroutine.

# try this:

$a = "BIZ";

sub main
{
	my $a = "FOO";
	mysub();
}

sub mysub
{
	print $a, "\n";
}

# then a call of "main()" will print "BIZ",
# the global value of "a".


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

Date: Tue, 09 Feb 1999 13:31:20 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: yong@shell.com
Subject: Re: Understanding my
Message-Id: <36C07EF8.D738591@giss.nasa.gov>

yong@shell.com wrote:
> 
> Programming Perl says "Subroutines called from within the scope of such a
> private variable cannot see the private variable unless the subroutine is also
> textually declared within the scope of the variable." But why does the code
> below print a my variable correctly?
> 

<snip>

you're passing "a" as an argument to the subroutine.

# try this:

$a = "BIZ";

sub main
{
	my $a = "FOO";
	mysub();
}

sub mysub
{
	print $a, "\n";
}

# then a call of "main()" will print "BIZ",
# the global value of "a".


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

Date: Tue, 09 Feb 1999 18:47:26 GMT
From: bmusee2@pacbell.net (ron)
Subject: Very Very Newbie- re: perl5.0042-bindist.04bc
Message-Id: <36c077b8.6800689@news.pacbell.net>

I am running Win98 and am totally new to Perl..I am trying to run a
program that operates in Perl (quotemonster) which gathers stock data
at the end of the day.   I downloaded perl5.0042 -bindist.04bc and
installed it via default to C:\Perl etc.  Now my very nieve question
is ---How do I run a program ?  The quotemonster program has the
script but I have no concept of how to run it.   I run perl and it
opens a dos box I then enter qm and nothing happens  can anyone tell
me what the commands should look like and should it be in dos?


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

Date: 09 Feb 1999 18:38:23 +0000
From: Philip Shotton <phil@iisc.co.uk>
Subject: Re: Would love UNIX program that could read Excel binary file...
Message-Id: <tvlni71kyo.fsf@mchenry.iisc.co.uk>

vitus@wagner.rinet.ru (Victor Wagner) writes:

> wsherrin <wsherrin@eccms1.dearborn.ford.com> wrote:
> : Hi techical friends -
> 
> : Been surfing for a couple of days, but no luck...
> 
> : Does anyone know of a FREE Magical Perl module or
> 
> Try http://www.ice.ru/~vitus/catdoc/xls2csv.html
> -- 
> --------------------------------------------------------
> I have tin news and pine mail...
> Victor Wagner @ home       =         vitus@wagner.rinet.ru 

Try Wingz. Best spreadsheet in the world :-) (yes I do work for them.

Free for Linux (on sunsite and all good mirrors). Commercially
available for Win32, Apple Mac, Solaris, SunOS, AIX, HPUX, SGI.

Phil

check out the website: www.wingz.com - downloads available.


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

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

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