[22172] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4393 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 13 09:05:51 2003

Date: Mon, 13 Jan 2003 06:05:08 -0800 (PST)
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, 13 Jan 2003     Volume: 10 Number: 4393

Today's topics:
    Re: calculate regexp? <mgjv@tradingpost.com.au>
    Re: finding largest repeat values in array Andrew Lee
    Re: formmail.pl strange output <bilkay@xxxlocalnet.com>
        How to check responce on specific tcp-ports? <a@b.c>
    Re: How to check responce on specific tcp-ports? <josef.moellers@fujitsu-siemens.com>
    Re: My, our, etc. <simon.andrews@bbsrc.ac.uk>
    Re: ppm query <Ingo_Wiarda@web.de>
        Question about using "system" function. <fred@removeme.unique.com>
    Re: Question about using "system" function. (Anno Siegel)
    Re: Question about using "system" function. Andrew Lee
    Re: reading commandline parameters <a24061@void.yahoo.void.com>
        recover domain name stan.holmes@eskom.co.za
    Re: recover domain name <nobull@mail.com>
    Re: recover domain name <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: recover domain name news@roaima.freeserve.co.uk
        search and replace problem (Urs Klingsporn)
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
        strange sort problem (Mr I)
    Re: strange sort problem (Anno Siegel)
    Re: undef of large Hashes/Arrays took a very long time <Jan.Schubert@GMX.li>
        When does (pre|post)increment happen? (Peter J. Acklam)
    Re: When does (pre|post)increment happen? <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: When does (pre|post)increment happen? <nobull@mail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 13 Jan 2003 20:35:43 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: calculate regexp?
Message-Id: <slrnb2523f.7m2.mgjv@martien.heliotrope.home>

On Sun, 12 Jan 2003 06:13:17 +0100,
	oblomov <spam@oblomov.org> wrote:
> On Sun, 12 Jan 2003 05:01:33 GMT
> "Jürgen Exner" <jurgenex@hotmail.com> wrote:
> 
>> If you want to generate your parser based upon some language
>> description then please have a look at e.g. lexx, bison, yacc, and all
>> the other parser generators out there.
> 
> Actually, it is a very simple interpreter. 
> The grammar consits of 15 rules.

Are you aware of the Parse::RecDescent module? Maybe that's more what
you're looking for than what you think you should be looking for.

> And I need to learn how to build regexpes :)

Yep. You do.

Martien
-- 
                        | 
Martien Verbruggen      | Blessed are the Fundamentalists, for they
                        | shall inhibit the earth.
                        | 


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

Date: Mon, 13 Jan 2003 07:44:27 -0500
From: Andrew Lee
Subject: Re: finding largest repeat values in array
Message-Id: <dvc52v8m82fajbhc0ad6b6b0idimkgrr0q@4ax.com>

On 07 Jan 2003 16:44:36 GMT, ctcgag@hotmail.com wrote:

>hugo <hugo@geoinformex.com> wrote:
>> Hi
>>
[question snipped]

>You need to reset repeat, and capture the greatest value.
>
>my $most=-1;
>my $repeat=1;
>for my $i (1..@myArray) {
>  if (myArray[$i] eq myArray[$i -1]) {
>     $repeat++;

Ack!!!

That won't work unless you have reset $[ (a soon to be deprectaed
"feature").



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

Date: Mon, 13 Jan 2003 08:39:51 -0500
From: "Bill K." <bilkay@xxxlocalnet.com>
Subject: Re: formmail.pl strange output
Message-Id: <20030113.083950.680466996.19008@xxxlocalnet.com>

In article <1291988.4ZopqyBtoI@nyoga.dubu.de>, "Harald H.-J. Bongartz"
<bongie@gmx.net> wrote:

> ...
>> I've looked through the code fairly thoroughly and can't find anything
>> that would reference code outside the script. This isn't a big deal, as
>> far as I can tell, but it's had me scratching my head so much, I'm
>> losing hair. Can someone help me to put this to rest?
> 
> Probably your hoster already installed the nms script in /cgi-bin
> (praise him ;-)), and you're accessing the wrong URL?  I'm only
> guessing, though.

I'm mostly just curious about how it's done. CGI does run my script (it
accepts the modifications needed to make it work). What I'm guessing is
that my host's perl compiler is substituting other subroutines, which is
very strange, considering that their home page points to Matt's archive for CGI
scripts! I did find that if I change the name of the file, it runs Matt's
(crappy?) subs.

Thanks!


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

Date: Mon, 13 Jan 2003 14:42:25 +0100
From: ZZT <a@b.c>
Subject: How to check responce on specific tcp-ports?
Message-Id: <avufo1$3g8$1@news1.wdf.sap-ag.de>

Hello,

I would like to check responce on specific tcp-ports. Is there a simple 
way to detect if the given machine/ip-address is listening on this port?

thank you very much!
bye



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

Date: Mon, 13 Jan 2003 14:54:02 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: How to check responce on specific tcp-ports?
Message-Id: <3E22C4FA.799ED6C@fujitsu-siemens.com>

ZZT wrote:
> =

> Hello,
> =

> I would like to check responce on specific tcp-ports. Is there a simple=

> way to detect if the given machine/ip-address is listening on this port=
?

This is called a port scan.
It is very rude, to say the least.
Not giving your real name indicates that you know that.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: Mon, 13 Jan 2003 13:35:54 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: My, our, etc.
Message-Id: <3E22C0BA.67DD0666@bbsrc.ac.uk>

Richard S Beckett wrote:
> 
> "Koos Pol" <koos_pol@NO.nl.JUNK.compuware.MAIL.com> wrote in message
> news:newscache$u43i8h$cb7
> 
> > What were the warnings/errors? Commenting on them without seeing them is
> > hard to do.
> 
[snip a couple of other forms of the same problem]
> <test2.pl>
> use strict;
> use warnings;
> use Tk;
> our ($frame, $entry);
> $entry = $frame -> Entry (
>           -validatecommand => \&valid_routine,
>           -invalidcommand => sub {
>                print "invalid entry, try again\n";
>                $entry -> focus;}
>           ) -> pack ();
> <test2.pl>
> 
> Can't call method "Entry" on an undefined value at test2.pl line 10. [Which
> we'll call success, in this instance.]

But it isn't a success - you've just managed to generate a slightly
different fatal warning!  You have exactly the same problems in the last
example as you had in the others, just shuffled around a bit!

Perl is desperately trying to tell you you're in trouble and you need to
listen to it :-)

From looking at your code I suspect you're new to Tk and Perl objects in
general.  The problem you're having above is only partially related to
scoping, and seems to result from a misunderstanding of how objects
work.  I strongly suggest you get a book on Perl-Tk and have a good
read.  It took me a good while to get my head around how it all works!

Your problem is that you are missing the basic toplevel objects which
are required as containers for the entry widget you are trying to make. 
Assuming you are wanting to use frames as well then you need at least a
main window, and a frame inside that before you can start filling it. 
Just making a variable called $frame and then trying to use that to
create widgets isn't going to work (as you found out!).

Try playing with the code below, which shows a basic working Tk script
which does the sort of thing you're trying to do...

For future reference there is a comp.lang.perl.tk newsgroup which may be
a better place to put any future Tk related questions.

Hope this helps to get you started!

	TTFN

	Simon.


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

# Make a main window for everything to go in
my $main_win = new MainWindow;

# If you want to use frames then you need to create
# a frame inside the existing main window
my $frame = $main_win->Frame()->pack();

# Now you can create your entry widget and put it
# inside
my $entry = $frame->Entry (-width=>10,
			   -validate=> 'all',
			   -validatecommand=>\&validate,
			   -invalidcommand=>sub {
			     warn "That wasn't a number\n"
			   },
			  )->pack();

# Now you've made your entry, you can tell it to
# take focus
$entry -> focus();

# Then set Tk running so it can accept signals
MainLoop;

# Lastly we need to create the subroutine
# to validate the input from our entry.
sub validate {
  # Collect what was entered
  my ($entered) = @_;

  # Return true only it its an integer.
  return ($entered =~/^\d+$/);
}


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

Date: Mon, 13 Jan 2003 10:15:45 +0100
From: Ingo Wiarda <Ingo_Wiarda@web.de>
Subject: Re: ppm query
Message-Id: <avu023$jor58$1@ID-40614.news.dfncis.de>

Fred wrote:

> Hello there,
> 
> I am using Active Perl 5.6 on Win 98
> When I want to display the list of installed modules from the DOS
> prompt using
> ppm query <enter>
> a long list flashes over the screen and I get to see only the last 25
> lines.
> Redirection to a file with
> ppm query > C:\aa\list.txt
> makes no change.
> Is there a way to see (or print to file) the whole list ?
> ---
> Fred

Have you tried "ppm" at the prompt? This should start ppm in interactive 
mode. A following 'query foo' will be displayed page by page.

Ingo


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

Date: Mon, 13 Jan 2003 10:09:12 +0000
From: Fred Clausen <fred@removeme.unique.com>
Subject: Question about using "system" function.
Message-Id: <YfwU9.86$OF4.1225@news.uk.colt.net>

Hi All,

I am writing a program that loops through some directories then runs two 
programs to process some files in the directories, eg:

for ($i=0;$i < 100;$i++) {
 system ("program1 --out program1-out.data");
 system ("program2 --in program1-out.data --out program2-out.data');
}

program1-out.data is data produced by program1 and program2-out.data is 
data produced by program2. Program2 reads the data produced by program1, 
namely program1-out.data.

The proplem is that program1 never completes. I have run program1 manually 
with the same parameters as they are called in the script and it runs just 
fine. But from the script program1 either does not finish or program2 is 
launched before all the data is written by program1 and so program2 
produces incomplete data. If am am unlcear in any way, please feel free to 
ask me clarify.

Any assistance in this regard will be appreciated.

Regards, Fred.


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

Date: 13 Jan 2003 10:37:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question about using "system" function.
Message-Id: <avu4tv$e2u$1@mamenchi.zrz.TU-Berlin.DE>

Fred Clausen  <fred@removeme.unique.com> wrote in comp.lang.perl.misc:
> Hi All,
> 
> I am writing a program that loops through some directories then runs two 
> programs to process some files in the directories, eg:
> 
> for ($i=0;$i < 100;$i++) {
>  system ("program1 --out program1-out.data");
>  system ("program2 --in program1-out.data --out program2-out.data');
> }
> 
> program1-out.data is data produced by program1 and program2-out.data is 
> data produced by program2. Program2 reads the data produced by program1, 
> namely program1-out.data.
> 
> The proplem is that program1 never completes. I have run program1 manually 
> with the same parameters as they are called in the script and it runs just 
> fine. But from the script program1 either does not finish or program2 is 
> launched before all the data is written by program1 and so program2 
> produces incomplete data.

What is the meaning of "either ... or" here?  Are you saying it can
be either one, you can't decide, or are you saying it does sometimes
one and sometimes the other for no apparent reason?

When "system xyz" returns before the run of xyz is completed, that
usually means that program xyz puts itself in the background.  In
that case, the process that Perl has started is done almost immediately,
so system() returns.  Perl doesn't know about any possible detached
jobs xyz may have started in the meantime.

When the program doesn't finish, what can we say?  We don't know
its properties, so there's no way of even guessing the reason.


Anno


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

Date: Mon, 13 Jan 2003 06:30:21 -0500
From: Andrew Lee
Subject: Re: Question about using "system" function.
Message-Id: <hu752vkse18mffr4a693vj0j71nfk1b9ns@4ax.com>

On Mon, 13 Jan 2003 10:09:12 +0000, Fred Clausen
<fred@removeme.unique.com> wrote:

>Hi All,
>
>I am writing a program that loops through some directories then runs two 
>programs to process some files in the directories, eg:
>
>for ($i=0;$i < 100;$i++) {
> system ("program1 --out program1-out.data");
> system ("program2 --in program1-out.data --out program2-out.data');
>}

I would write this for loop as :

for (1..100)

Unless you are using $i in the system calls.

>
>program1-out.data is data produced by program1 and program2-out.data is 
>data produced by program2. Program2 reads the data produced by program1, 
>namely program1-out.data.
>
>The proplem is that program1 never completes. 

Your calling script hangs?

Try :

my $rv = system ("program1 --out program1-out.data");
unless ($rv == 0) {
	# print the child error 
	die "program1 failed : $?";
}

If you need the return value from program1 print "$? >> 8";  

>I have run program1 manually 
>with the same parameters as they are called in the script and it runs just 
>fine. But from the script program1 either does not finish or program2 is 
>launched before all the data is written by program1 and so program2 
>produces incomplete data. If am am unlcear in any way, please feel free to 
>ask me clarify.

This makes me wonder about your environment.  Are you running the Perl
program as yourself?  Are you running program1 as yourself?  Is
program1 in the current working directory?  Is program1 in your path?

e.g. if you change directories and execute program1 (and it is not in
the current working directory) system ("program1 --out
program1-out.data"); will silently fail -- you should always check the
return value and $? (child error);

If you are asking another piece of software to execute your Perl
program (such as a web server) then you should not, in general, expect
the same results from system() as from the command line.


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

Date: Mon, 13 Jan 2003 08:10:38 GMT
From: Adam <a24061@void.yahoo.void.com>
Subject: Re: reading commandline parameters
Message-Id: <2wuU9.1415$lW6.12626097@news-text.cableinet.net>

On Sunday 12 January 2003 23:14, Tad McClellan wrote:

> Tommi <nomail@mail.com> wrote:
>> 
>> How can I read commandline parameters?
> 
> 
> You do not need to read them, perl already has them loaded
> into an array (@ARGV) for you.

And if you want to parse options, use a module: 
Getopt::Std
  foo -v -n 3
or Getopt::Long
  foo --verbose --nbr=3



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

Date: Mon, 13 Jan 2003 10:49:20 +0200
From: stan.holmes@eskom.co.za
Subject: recover domain name
Message-Id: <avtujh$2r0d$1@nnrp01.ops.uunet.co.za>

Hi
I need to recover the domain name in a URL string

http://www.microsoft.com/search...

I need only the www.microsoft.com
Thanks
   Stan




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

Date: 13 Jan 2003 09:03:15 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: recover domain name
Message-Id: <u9el7hl8vg.fsf@wcl-l.bham.ac.uk>

stan.holmes@eskom.co.za writes:

> I need to recover the domain name in a URL string
> 
> http://www.microsoft.com/search...
> 
> I need only the www.microsoft.com

Obviously a simple regex would do but I think it's more elegant to use
the URI module to parse URIs.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 13 Jan 2003 10:05:05 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: recover domain name
Message-Id: <newscache$hkan8h$zw8$1@news.emea.compuware.com>

stan.holmes@eskom.co.za wrote (Monday 13 January 2003 09:49):

> Hi
> I need to recover the domain name in a URL string
> 
> http://www.microsoft.com/search...
> 
> I need only the www.microsoft.com
> Thanks
>    Stan


What did you try and what were the results?


-- 
KP



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

Date: Mon, 13 Jan 2003 10:20:28 +0000
From: news@roaima.freeserve.co.uk
Subject: Re: recover domain name
Message-Id: <ct3uva.e17.ln@moldev.cmagroup.co.uk>

stan.holmes@eskom.co.za wrote:
> I need to recover the domain name in a URL string
> http://www.microsoft.com/search...

What have you tried so far?
Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: 13 Jan 2003 05:30:11 -0800
From: uk@websting.de (Urs Klingsporn)
Subject: search and replace problem
Message-Id: <8ce9ec58.0301130530.36f1194d@posting.google.com>

my @entry_keys;
my %entry;
my $mask;

    @entry_keys = keys(%entry);
    for(my $k = 0; $k < @entry_keys; $k++) 
    {
      $mask = '§' . lc($entry_keys[$k]) . '§';
      $output =~ s/$mask/$entry{$entry_keys[$k]}/gimo;
    }

it's part of a cgi script. i'm quit a newbie so...

in short: all keys of %entry that occur in the string $output should
be replaced with the value of the hash. it works for $k = 0 but there
rest is just left as it is. what am i missing. I didn't found a
solution so far...

thx urs


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

Date: Mon, 13 Jan 2003 13:25:50 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <v25fiukljos29c@corp.supernews.com>

Following is a summary of articles spanning a 7 day period,
beginning at 06 Jan 2003 14:02:52 GMT and ending at
13 Jan 2003 13:01:23 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2003 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Excluded Posters
================

perlfaq-suggestions\@(?:.*\.)?perl\.com
faq\@(?:.*\.)?denver\.pm\.org
comdog\@panix\.com

Totals
======

Posters:  260
Articles: 853 (356 with cutlined signatures)
Threads:  179
Volume generated: 1681.6 kb
    - headers:    769.0 kb (14,402 lines)
    - bodies:     859.9 kb (28,711 lines)
    - original:   496.7 kb (18,434 lines)
    - signatures: 51.8 kb (1,278 lines)

Original Content Rating: 0.578

Averages
========

Posts per poster: 3.3
    median: 2.0 posts
    mode:   1 post - 123 posters
    s:      6.9 posts
Posts per thread: 4.8
    median: 4 posts
    mode:   3 posts - 33 threads
    s:      4.5 posts
Message size: 2018.7 bytes
    - header:     923.2 bytes (16.9 lines)
    - body:       1032.3 bytes (33.7 lines)
    - original:   596.2 bytes (21.6 lines)
    - signature:  62.2 bytes (1.5 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   85   208.2 ( 99.2/ 97.3/ 61.0)  tadmc@augustmail.com
   42    90.1 ( 34.0/ 47.9/ 27.0)  Benjamin Goldberg <goldbb2@earthlink.net>
   27    44.8 ( 24.3/ 20.5/ 10.7)  "Jürgen Exner" <jurgenex@hotmail.com>
   25    53.5 ( 18.7/ 34.8/ 15.3)  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
   24    51.4 ( 24.5/ 21.8/ 12.9)  "Harald H.-J. Bongartz" <bongie@gmx.net>
   24    50.2 ( 22.7/ 25.7/ 15.2)  Brian McCauley <nobull@mail.com>
   18    43.2 ( 18.7/ 19.0/  6.9)  Uri Guttman <uri@stemsystems.com>
   14    29.6 ( 18.5/ 11.1/  5.8)  andrew
   14    24.2 (  9.9/ 14.3/  8.5)  Jay Tilton <tiltonj@erols.com>
   14    22.9 ( 13.7/  9.2/  5.3)  "Kasp" <kasp@epatra.com>

These posters accounted for 33.6% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

 208.2 ( 99.2/ 97.3/ 61.0)     85  tadmc@augustmail.com
  90.1 ( 34.0/ 47.9/ 27.0)     42  Benjamin Goldberg <goldbb2@earthlink.net>
  53.5 ( 18.7/ 34.8/ 15.3)     25  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
  51.4 ( 24.5/ 21.8/ 12.9)     24  "Harald H.-J. Bongartz" <bongie@gmx.net>
  50.2 ( 22.7/ 25.7/ 15.2)     24  Brian McCauley <nobull@mail.com>
  44.8 ( 24.3/ 20.5/ 10.7)     27  "Jürgen Exner" <jurgenex@hotmail.com>
  43.2 ( 18.7/ 19.0/  6.9)     18  Uri Guttman <uri@stemsystems.com>
  34.4 ( 11.6/ 22.8/  7.0)      9  "joeri" <jvandervloet@hotmail.com>
  32.6 (  8.0/ 22.9/ 14.6)      9  tassilo.parseval@post.rwth-aachen.de
  29.6 ( 18.5/ 11.1/  5.8)     14  andrew

These posters accounted for 37.9% of the total volume.

Top 10 Posters by Volume of Original Content (min. five posts)
==============================================================

        (kb)
Posts   orig  Address
-----  -----  -------

   85   61.0  tadmc@augustmail.com
   42   27.0  Benjamin Goldberg <goldbb2@earthlink.net>
   25   15.3  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
   24   15.2  Brian McCauley <nobull@mail.com>
    9   14.6  tassilo.parseval@post.rwth-aachen.de
   24   12.9  "Harald H.-J. Bongartz" <bongie@gmx.net>
    9   10.8  "Alan J. Flavell" <flavell@mail.cern.ch>
   27   10.7  "Jürgen Exner" <jurgenex@hotmail.com>
   14    8.5  Jay Tilton <tiltonj@erols.com>
    9    7.0  "joeri" <jvandervloet@hotmail.com>

These posters accounted for 36.8% of the original volume.

Top 10 Posters by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.776  ( 10.8 / 13.9)      9  "Alan J. Flavell" <flavell@mail.cern.ch>
0.692  (  5.3 /  7.7)      6  hal@thresholddigital.com
0.640  (  6.1 /  9.5)      9  helgi@decode.is
0.638  ( 14.6 / 22.9)      9  tassilo.parseval@post.rwth-aachen.de
0.629  (  1.8 /  2.9)      5  "David K. Wall" <usenet@dwall.fastmail.fm>
0.627  ( 61.0 / 97.3)     85  tadmc@augustmail.com
0.622  (  6.6 / 10.6)      7  Ben Morrow <mauzo@mimosa.csv.warwick.ac.uk>
0.607  (  5.6 /  9.2)      5  Michele Dondi <bik.mido@tiscalinet.it>
0.600  (  6.6 / 11.0)      6  "Richard S Beckett" <spikey-wan@bigfoot.com>
0.594  (  1.2 /  2.0)      5  chris-usenet@roaima.freeserve.co.uk

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.428  (  3.3 /  7.7)     12  Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
0.408  (  1.0 /  2.6)      5  Matija Papec <mpapec@yahoo.com>
0.399  (  2.3 /  5.7)      7  Tony L. Svanstrom <tony@svanstrom.com>
0.390  (  1.3 /  3.3)      5  'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com>
0.375  (  1.4 /  3.8)      5  Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
0.363  (  6.9 / 19.0)     18  Uri Guttman <uri@stemsystems.com>
0.357  (  2.8 /  8.0)      7  Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca>
0.325  (  1.4 /  4.3)      6  mthunter@uiuc.edu
0.306  (  7.0 / 22.8)      9  "joeri" <jvandervloet@hotmail.com>
0.239  (  1.7 /  6.9)      9  "John W. Krahn" <krahnj@acm.org>

40 posters (15%) had at least five posts.

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   26  These are discouraging stats to Perlistas & Pythonistas...
   24  using subroutines defined in other scripts
   23  How does one determine why perl prog runs so slow????
   17  insert newlines in a long string
   16  Reg Expression help
   15  Printing  to webpage
   14  Detecting media change/closing of CD tray?
   13  suggested revisions for the Posting Guidelines
   13  Noob:  Variable is getting reset, but why?
   12  Arrays. What don't I get?

These threads accounted for 20.3% of all articles.

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

  68.4 ( 30.0/ 37.4/ 14.1)     24  using subroutines defined in other scripts
  55.6 ( 22.1/ 30.4/ 16.0)     23  How does one determine why perl prog runs so slow????
  51.1 ( 25.2/ 24.8/ 11.0)     26  These are discouraging stats to Perlistas & Pythonistas...
  34.8 ( 11.9/ 21.1/ 12.1)     13  Noob:  Variable is getting reset, but why?
  31.8 ( 10.8/ 20.0/  9.2)     10  parsing xml with perl --- very urgent .. help please
  31.1 ( 10.2/ 20.5/  9.3)     12  Arrays. What don't I get?
  29.9 (  9.0/ 20.3/ 13.5)     10  My, our, etc.
  28.4 ( 12.7/ 15.5/  6.8)     14  Detecting media change/closing of CD tray?
  28.4 ( 12.1/ 15.6/ 10.9)     12  Taint check question
  28.0 ( 13.3/ 13.6/  8.0)     13  suggested revisions for the Posting Guidelines

These threads accounted for 23.0% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.853  (  3.3/   3.9)      5  removing duplicate values from array not working...
0.786  (  2.7/   3.4)      7  autoresponse email
0.766  (  2.3/   3.1)      6  pointer & stack data structure?
0.733  (  2.1/   2.9)      5  EXCEL OLE functions
0.701  ( 10.9/  15.6)     12  Taint check question
0.696  (  2.8/   4.0)      6  word lenght
0.676  (  1.3/   1.9)      6  error with @ sign
0.670  ( 10.4/  15.6)     10  CGI - HTML Generation problems with images - scripts etc
0.667  (  1.3/   1.9)      6  Finding required .pl's home ?
0.666  ( 13.5/  20.3)     10  My, our, etc.

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.439  (  6.8 / 15.5)     14  Detecting media change/closing of CD tray?
0.436  (  2.7 /  6.2)      7  Simple Filter
0.418  (  3.3 /  7.9)      8  grep  ==  ??
0.408  (  1.5 /  3.7)      5  Dealing with split() and quotes
0.406  (  3.6 /  8.9)      5  Another string matching question.
0.403  (  1.7 /  4.1)      6  Activeperl : ppm and GD
0.386  (  2.1 /  5.5)      7  Problem with huge dataset, 100000000 a magic number?
0.376  ( 14.1 / 37.4)     24  using subroutines defined in other scripts
0.369  (  2.4 /  6.6)      5  Need to enter to finish perl script
0.352  (  1.6 /  4.4)      6  silly question -- please help!

67 threads (37%) had at least five posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      25  comp.lang.python
       3  alt.perl
       3  comp.lang.perl.modules
       2  comp.lang.perl
       1  fr.comp.lang.perl
       1  comp.mail.sendmail
       1  cn.comp.lang.perl
       1  tw.bbs.comp.lang.perl
       1  de.comp.lang.perl.misc

Top 10 Crossposters
===================

Articles  Address
--------  -------

       5  "oooooops" <oooooops@163.com>
       3  Sara <genericax@hotmail.com>
       2  Mike Meyer <mwm@mired.org>
       2  Peter Hansen <peter@engcorp.com>
       1  "Robert Oschler" <Oschler@earthlink.net>
       1  "Harald H.-J. Bongartz" <bongie@gmx.net>
       1  dsavitsk <dsavitsk@ecpsoftware.com>
       1  Dhruv <dmalhotr2001@yahoo.com>
       1  Warren Postma <warren.postma@adaptivenetworks.on.ca>
       1  andrew


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

Date: 13 Jan 2003 02:21:34 -0800
From: konny@waitrose.com (Mr I)
Subject: strange sort problem
Message-Id: <6985a862.0301130221.7d9a165c@posting.google.com>

this is my issue:

attempting to run a simple sort:

have a 59 element array of hashref's
hash has 17 elements one being 'Name'
i.e.
$vals = (
{Name=>'test',Type='oak'.....
)

<code snipet>
sub test1 {
        ($myval) =@_;
        my (@tmp);

        @tmp = sort {$a->{NAME} cmp $b->{Name}} (@{$myval});

        for $indx (@tmp) {
                for $erm (sort(keys(%{$tmp[$indx]}))) {
                        print "$tmp[$indx]->{$erm},";
                }#for
                print "\n";
                <STDIN>;
        }#for
}

</code snipet>

The problem is that I am running out of memeory during the sort.
if i run debugber I get:
  DB<1> c 150
main::test1(hashsort.pl:150):             @tmp = sort {$a->{NAME} cmp
$b->{Name}} (@{$myval});
  DB<2> c 152
only after pressing <cr>
main::test1(hashsort.pl:152):             for $indx (@tmp) {
  DB<3>x scalar @$myval
0  59
  DB<4> x scalar @tmp
0  3667097
  DB<5>


I do not know why @tmp is so big, whats more after $tmp[58] all
elements are undef?

Any help welcome


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

Date: 13 Jan 2003 10:57:12 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: strange sort problem
Message-Id: <avu628$f2q$1@mamenchi.zrz.TU-Berlin.DE>

[bogus newsgroup perl.beginners removed]

Mr I <konny@waitrose.com> wrote in comp.lang.perl.misc:
> this is my issue:
> 
> attempting to run a simple sort:
> 
> have a 59 element array of hashref's
> hash has 17 elements one being 'Name'
> i.e.
> $vals = (
> {Name=>'test',Type='oak'.....
> )
> 
> <code snipet>
> sub test1 {
>         ($myval) =@_;
>         my (@tmp);
> 
>         @tmp = sort {$a->{NAME} cmp $b->{Name}} (@{$myval});
> 
>         for $indx (@tmp) {

$indx is one of the elements of @tmp, so it's a hashref.  You probably
meant "for $indx ( 0 .. @tmp - 1 )".

>                 for $erm (sort(keys(%{$tmp[$indx]}))) {
                                             ^^^^^
Here you are using $indx as an array index into @tmp.  Used as an
integer, the hashref is likely to be a huge value.  No wonder you
run out of memory.

>                         print "$tmp[$indx]->{$erm},";
>                 }#for
>                 print "\n";
>                 <STDIN>;
>         }#for
> }
> 
> </code snipet>
> 
> The problem is that I am running out of memeory during the sort.

Switch on warnings, and make the program strict-compliant while you're
at it.  "warnings" would have told you that you are using a reference
as an array index.  Before you ask the newsgroup for help, ask Perl.

Anno


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

Date: Mon, 13 Jan 2003 10:51:40 +0100
From: Jan Schubert <Jan.Schubert@GMX.li>
Subject: Re: undef of large Hashes/Arrays took a very long time
Message-Id: <avu283$iugd2$1@ID-2265.news.dfncis.de>

Pierre Asselin wrote:
> In <3E20B47D.56246AB6@earthlink.net> Benjamin Goldberg <goldbb2@earthlink.net> writes:
> 
> 
>>Why are you undefing, instead of declaring the array as a lexical
>>variable and merely letting it go out of scope?  Or assigning an empty
>>list to it?
> 
> 
> I no longer have the script.  I don't remember if I undef'd the stuff
> or assigned empties.  The data structures were at (main) mackage
> scope.  I know that one version of the script did *nothing* to reclaim
> memory, and it took forever to exit after it was done (confirmed by
> unbufferred prints).
> 
> 
> 
>>When you undef() an array or hash, you're doing something very spec ial,
>>which often has bad consequences on performance.
> 
> 
> Ok, so the OP should try assigning () and see if that helps.
So i did it, but no success at all. The same behaviour as before. The 
array has approximately 35 Mio. entries and is using ca. 1.6 GB in Memory.

Thx,
Jan



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

Date: 13 Jan 2003 00:51:28 -0800
From: pjacklam@online.no (Peter J. Acklam)
Subject: When does (pre|post)increment happen?
Message-Id: <fe4612a5.0301130051.7f5ee55d@posting.google.com>

The following results confuse me.  I expected
to get 0.5 and 1:

   $ perl -wle '$n = 1 ; print $n / ++$n'
   1

   $ perl -wle '$n = 1 ; print $n / $n++'
   2

In the first case, I expected to get 0.5 because
the preincrement would increment $n so the numerator
became 2, thus giving 1/2 = 0.5.

In the second case, I expected to get 1 because
the postincrement would increment $n *after* the
division was performed, thus giving 1/1 = 1.

I'd be thankful if anyone would explain...

Peter


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

Date: Mon, 13 Jan 2003 10:21:54 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: When does (pre|post)increment happen?
Message-Id: <newscache$icbn8h$ey8$1@news.emea.compuware.com>

Peter J. Acklam wrote (Monday 13 January 2003 09:51):

> The following results confuse me.  I expected
> to get 0.5 and 1:
> 
>    $ perl -wle '$n = 1 ; print $n / ++$n'
>    1


The sequence of evals is:
$n = 1;
print $n / ++$n;    # $n == 2
print $n / 2;       # $n == 2
print 2 / 2;        # 1


>    $ perl -wle '$n = 1 ; print $n / $n++'
>    2


The sequence of evals is:
$n = 1;
print $n / $n++;    # $n == 1
print $n / 1;       # $n == 2
print 2 / 1;        # 2


HTH
-- 
KP



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

Date: 13 Jan 2003 13:01:23 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: When does (pre|post)increment happen?
Message-Id: <u965stkxuk.fsf@wcl-l.bham.ac.uk>

pjacklam@online.no (Peter J. Acklam) writes:

> Subject: When does (pre|post)increment happen?

The increment happens at the time the (pre|post)increment
subexpression is evaluated.  It is _not_ pre- or post- the whole
expression that contains it.

For numeric $n you can model ++$n as:

  do { $n += 1; $n }

And $n++ as:

  do { my $o = $n; $n += 1; $o }

>    $ perl -wle '$n = 1 ; print $n / ++$n'
>    1
> 
>    $ perl -wle '$n = 1 ; print $n / $n++'
>    2

> I'd be thankful if anyone would explain...

The first thing to note is that you should not rely on the evaluation
order staying the same in all future versions of Perl.

That said, you can usually explain the current behaviour as
depth-first left-to-right traversal of the parse-tree but with any
lvalue expressions (such as '$n') that are used in an rvalue context
(such as the the operand of a division) being converted as late as
possible.

It is also important to note that many Perl expressions (such as ++$n)
are implemented as returning lvalues even though a (mis-)feature of
the compiler prevents them being used on the LHS of an asignment
operator.

So in...

 $n / ++$n

First the LHS operand of / is evaluated to the lvalue $n.

Next the RHS operand of / is evaluated to the lvalue $n, incrementing
$n to 2 at the same time.

Next the lvalues ($n,$n) are converted to rvalues (2,2).

Then 2/2 is evaluated to 1.

And in... 

 $n / $n++

First the LHS operand of / is evaluated to the lvalue $n.

Next the RHS operand of / is evaluated to the the rvalue 1,
incrementing $n to 2 at the same time.

Next the lvalue $n is converted to rvalue 2.

Then 2/1 is evaluated to 2.

--      
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 4393
***************************************


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