[25530] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7774 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 12 18:05:44 2005

Date: Sat, 12 Feb 2005 15:05:15 -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           Sat, 12 Feb 2005     Volume: 10 Number: 7774

Today's topics:
    Re: Adding Form elements <amead@comcast.net>
    Re: Can I run perl under windows line by line? <jazeker_b_nospamlalala@yahoo.co.uk>
    Re: How to close a listening socket asynchronously <prilmeie@informatik.tu-muenchen.de>
    Re: Is there a more idiomatic way to do this? <junk@blackwater-pacific.com>
        Mac OS X Update -> module's man in / <news@chaos-net.de>
    Re: Mac OS X Update -> module's man in / <spamtrap@dot-app.org>
    Re: Mac OS X Update -> module's man in / <news@chaos-net.de>
        naming a variable with the datum from another variable (Duncan Harris)
    Re: naming a variable with the datum from another varia <noreply@gunnar.cc>
    Re: naming a variable with the datum from another varia (Anno Siegel)
    Re: naming a variable with the datum from another varia <jurgenex@hotmail.com>
    Re: naming a variable with the datum from another varia <matternc@comcast.net>
    Re: new to group, need a temperature perl script. <joe@inwap.com>
        perl extension promblem Can't find 'boot_<blah>' symbol <nyejeff@yahoo.com>
    Re: perl extension promblem Can't find 'boot_<blah>' sy <kalinaubears@iinet.net.au>
    Re: track how many moves to sort an array? (Anno Siegel)
        Web interface to Usenet (was Re: new to group, need a t <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 12 Feb 2005 11:25:00 -0600
From: Alan Mead <amead@comcast.net>
Subject: Re: Adding Form elements
Message-Id: <pan.2005.02.12.17.24.59.206801@comcast.net>

On Fri, 11 Feb 2005 13:10:42 -0800, dbmeyers23 wrote:

> All,
> 
> I have a form with about 150 fields that I would like to have added
> together automatically and the value placed into a new variable.
> Below, you will  see my @list.  Below that, I'm going through @list and
> only printing those values which have data (thanks to google.groups).
> 
> What I would like to do now, and I'm struggling a bit to do is add
> these quantities together....so anywhere I see "addquantity", I would
> like to keep adding the values until done..then place them in a new
> variable.  Any hints??

My advice would be to post more code and explain the code.  I don't
understand what you are doing.

But I do have some thoughts.

I wouldn't iterate over all the parameters, I would want a list of the
field names, call it "my @fieldnames".  Then:

my $newvalue=0;
foreach my $field (@fieldnames) {
  next unless (param($field));
  next unless ($field =~ 'addquantity');
  my @vals = param($field);
  foreach my $v (@vals) {
    $newvalue += $v;
  }
}

Since I don't understand what you are doing, I don't know if this does
what you want but it (1) declares a new variable and initializes it. 
That's not necessary but if you use warnings, I think it suppresses a
warning.  Then (2) you iterate over your field names.  The reason this is
preferable is that it's more secure. You skip fields which are blank (3)
or which do not contain the string 'addquanity' in their field names (4).
The fifth line captures values in the list @vals.  You wouldn't need a
list if you gave each field a unique name which is how most people do
it. The remaining lines accumulate the values.

If you refuse to create @fieldnames yourself, this code can be made to
walk the entire parameter list by saying "my @fieldnames = param();"

Hope this helps.

-Alan

-- 
Help out our research and get a free 
personality profile:
http://www.web-data-collection.org



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

Date: Sat, 12 Feb 2005 20:36:12 GMT
From: Jazeker <jazeker_b_nospamlalala@yahoo.co.uk>
Subject: Re: Can I run perl under windows line by line?
Message-Id: <0NtPd.10155$ny3.637992@phobos.telenet-ops.be>

wld wrote:
> I have installed Activeperl 5.8.6  MSI.
> and under ppm propmt: I give "search Win32::API" command
> select 1.Win32_API. installed Win32 API. Is this all I need to run perl
> under windows?

win32::API comes with ActivePerl, no need to install it.

> Waht does any package I need?

waht mean you ?

> Is it possible enter "perl mode" prompt then I can run a perl command
> line by line just like Tcl does.

Get the graphical debugger, Devel-ptkdb, which you can get via ppm as well.

-- 
print <<EOF;
   Just a noobish Perl hacker
EOF


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

Date: Sat, 12 Feb 2005 13:28:50 +0100
From: Franz Prilmeier <prilmeie@informatik.tu-muenchen.de>
Subject: Re: How to close a listening socket asynchronously
Message-Id: <Pine.GSO.4.60.0502121314300.21765@sunhalle89>

On Sat, 12 Feb 2005 xhoster@gmail.com wrote:

> Franz Prilmeier <prilmeie@informatik.tu-muenchen.de> wrote:
>> Hi,
>>
>> I want to write a simple SMTP server (As a side note with
>> Net::SMTP::Server) for evaluating incoming mails. One of my objectives is
>> having a proper server shutdown.
>
> What do you mean by a "proper server shutdown"?

Stopping the server listening.

>> I will try to argue on a code example:
>
> Your code also doesn't tell us what you mean by a proper server shutdown.
> Unless you mean that shutting down your server very second is proper, which
> I highly doubt.

I am not a perl guru, but I am definitely a Java guru. So I hope you get 
my intention on a Java example (See below, SocketTest.java). This is the 
output of that little program:

$ javac SocketTest.java && java SocketTest
starting server
Restarting Server:
Exception in Runner: java.net.SocketException: socket closed
starting server
Stopping Server:
Exception in Runner: java.net.SocketException: socket closed
Server exiting

That's exactly what I want to do in Perl. Stop the server listening 
while it's blocked doing an accept. Is there one way to do it?

>> I want to be able to close a socket while it is listening (waiting for
>> incoming connection via the accept call). In a different thread.
>
> Perl doesn't to threads very well.

That would be a show stopper. I have to do that in Perl because all my 
mates just know Perl.

>> And
>> definitely not by killing the whole program. I want to be able to do this
>> inside the same program.
>
> Upon what event?

I have a second control connection either by keyboard input or by remote 
command.

> By calling "accept", you are declaring that want to block until something
> connects.  If you don't want to block until something connects, don't
> call "accept" until/unless you know someone is knocking on the door.
>
> Stuff the $socket into an IO::Select object, then use can_read to see if
> there is something trying to connect to $socket. (See the example given in
> perldoc IO::Select).

As far as I got IO::Select, this means busy waiting to me.

Franz

-- Begin SocketTest.java --
import java.net.*;

public class SocketTest {
     public static void main ( String [] args ) throws Exception {
         ServerRunner sr = new ServerRunner ( 10025 );
         sr.start ();

         ServerStopper st = new ServerStopper ( sr );
         st.start ();
     }

     public static class ServerRunner extends Thread {
         private ServerSocket socket = null;
         private boolean shouldRun = true;
         int port;

         public ServerRunner ( int port ) throws Exception {
             this.port = port;
         }

         public void run () {
             while ( this.shouldRun ) {
                 Socket s = null;

                 try {
                     System.out.println ( "starting server" );
                     this.socket = new ServerSocket ( port );

                     while ( this.shouldRun ) {
                         s = this.socket.accept ();
                         System.out.println ( "Got a connection" );
                         s.close ();
                     }
                 } catch ( Exception e ) {
                     System.out.println ( "Exception in Runner: " + e );
                 } finally {
                     try {
                         if ( s != null ) s.close ();
                     } catch ( Exception e ) { /* Discard */ }
                 }
             }

             try {
                 this.socket.close ();
             } catch ( Exception e ) {
                 System.out.println (
                         "Exception in Runner during Socket close " + e );
             }

             System.out.println ( "Server exiting" );
         }

         public ServerSocket getServer () {
             return this.socket;
         }

         public void halt () {
             this.shouldRun = false;
         }
     }

     public static class ServerStopper extends Thread {
         private ServerRunner server;

         public ServerStopper ( ServerRunner sr ) {
             this.server = sr;
         }

         public void run () {
             try {
                 super.sleep ( 1000 );
                 System.out.println ( "Restarting Server:" );
                 this.server.getServer ().close ();

                 super.sleep ( 1000 );
                 System.out.println ( "Stopping Server:" );
                 this.server.halt ();
                 this.server.getServer ().close ();
             } catch ( Exception e ) {
                 System.out.println ( "Exception in Stopper: " + e );
             }
         }
     }
}
-- End of SocketTest.java --


-- 
Kind regards, Franz Prilmeier
WWW: http://home.in.tum.de/~prilmeie/ E-Mail: prilmeie@acm.org
GPG Public Key available at:
http://home.in.tum.de/~prilmeie/gpg/prilmeie@acm.org.asc


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

Date: Sat, 12 Feb 2005 12:07:19 -0800
From: Steve May <junk@blackwater-pacific.com>
Subject: Re: Is there a more idiomatic way to do this?
Message-Id: <110sntlittcot6f@corp.supernews.com>

Brian McCauley wrote:
> 
> 
> Steve May wrote:
> 
>> Alan Mead wrote:
>>
>>> my $dataref;
>>> $dataref = get_data($filename1) if ($condition==1);
>>> $dataref = get_data($filename2) if ($condition==2);
>>>
>>> Is there a more idiomatic way to do this? 
> 
>  >
> 
>> my $dataref = '';
>>
>> $files{$condition} and $dataref = get_data( $files{$condition} ); 
> 
> 
> It is most certainly _less_ ideomatic to use the empty sting to 
> represent the concept of "this has no value" rather than to use the 
> special undefined value.
> 

Well, yes.  But from a practical standpoint (for me anyway),
I find it less troublesome to always have defined values,
even if those values are empty strings.

I see no real problem with doing it this way unless there
is a major performance hit I am unaware of?

\s







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

Date: Sat, 12 Feb 2005 12:28:59 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Mac OS X Update -> module's man in /
Message-Id: <slrnd0rq3r.1cp.news@maki.homeunix.net>

Hello together,

I have updated my Mac OS X from 10.3.7 to 10.3.8 last night.

Today I was surprised to find a directory /man in / , which contains two
subdirs man1 and man3. Inside there are about 50 files which seem to be
related to modules, which I have installed.

Filenames are for example DBI.pm , DBD//mysql.3pm or
DBI//ProfileDumper//Apache.3pm.

Inside the files there is only manual text, but no perl code.

Now my main question is: Where do these files/directories have to go to?
And if anyone knows: Why did this happen; is this common?

Thanks in advance
Martin

-- 
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
 .32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'


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

Date: Sat, 12 Feb 2005 07:45:35 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Mac OS X Update -> module's man in /
Message-Id: <T-udnShhP9XtZ5DfRVn-qw@adelphia.com>

Martin Kissner wrote:

> I have updated my Mac OS X from 10.3.7 to 10.3.8 last night.
> 
> Today I was surprised to find a directory /man in /

These two things are unrelated. If you list the receipt for the 10.3.8
update package, or look at the time stamps on the files, you'll see that
they were not installed by the update.

> Now my main question is: Where do these files/directories have to go to?

If you use 'perldoc' to read Perl docs, they can go to the trash. :-)

If you use 'man', you can either set MANPATH to "/man:/usr/share/man:/usr
X11R6/man" in your environment, or you can move the files under /man to 
usr/share/man. Adjusting your environment is a simple, one-time fix. Moving
man pages would have to be done each and every time you install a new
module.

> And if anyone knows: Why did this happen; is this common?

Panther's Perl is misconfigured with respect to man paths - it has been from
day one. It's been discussed on the macosx _at_ perl.org list:

    http://www.mail-archive.com/macosx@perl.org/msg05918.html

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Sat, 12 Feb 2005 14:39:19 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Mac OS X Update -> module's man in /
Message-Id: <slrnd0s1o7.a7r.news@maki.homeunix.net>

Thank you for your feedback, Sherm.

Sherm Pendley wrote :
> Martin Kissner wrote:
>
>> I have updated my Mac OS X from 10.3.7 to 10.3.8 last night.
>> 
>> Today I was surprised to find a directory /man in /
>
> These two things are unrelated. If you list the receipt for the 10.3.8
> update package, or look at the time stamps on the files, you'll see that
> they were not installed by the update.

I did not think the update installed these files, but I thought it might
have moved them to /, although this seemed to be unlikely, too.

> If you use 'perldoc' to read Perl docs, they can go to the trash. :-)

I thought so. Just wanted to be sure.

>> And if anyone knows: Why did this happen; is this common?
>
> Panther's Perl is misconfigured with respect to man paths - it has been from
> day one. It's been discussed on the macosx _at_ perl.org list:
>
>     http://www.mail-archive.com/macosx@perl.org/msg05918.html

Thanks for the link. So I just did not notice the additional /man dir
before.
This misconfiguration has already hit me when trying to install
DBD::mysql.

Regards
Martin

-- 
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
 .32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'


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

Date: 12 Feb 2005 08:29:04 -0800
From: dunc_harris@hotmail.com (Duncan Harris)
Subject: naming a variable with the datum from another variable
Message-Id: <f4a49613.0502120829.1e90c3d5@posting.google.com>

I need to create a separate associative array for each column of data
that I have. However, the number of columns varies.  I wish to name
these arrays systematically, %x1, %x2 %x3 etc.

I wish to use a for loop to go through each of these in order and
process them.

How can I write the name of the variable %x# where # represents is the
counter for the loop?

(I know about for loops already and am writing a script).

Thanks in advance for any help.


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

Date: Sat, 12 Feb 2005 17:52:44 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: naming a variable with the datum from another variable
Message-Id: <376qiaF59ne5mU1@individual.net>

Duncan Harris wrote:
> I need to create a separate associative array for each column of data
> that I have. However, the number of columns varies.  I wish to name
> these arrays systematically, %x1, %x2 %x3 etc.
> 
> I wish to use a for loop to go through each of these in order and
> process them.
> 
> How can I write the name of the variable %x# where # represents is the
> counter for the loop?

You can make the associative arrays anonymous, and access them through a 
hash of hashes:

     my %col;
     $col{"x$_"} = {} for 1..5;

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 12 Feb 2005 17:05:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: naming a variable with the datum from another variable
Message-Id: <culd1i$lp7$1@mamenchi.zrz.TU-Berlin.DE>

Duncan Harris <dunc_harris@hotmail.com> wrote in comp.lang.perl.misc:
> I need to create a separate associative array for each column of data
                              ^^^^^^^^^^^^^^^^^
That's how they're named in awk and, yes, in some older Perl literature
too.  These days, the common name is "hash".

> that I have. However, the number of columns varies.  I wish to name
> these arrays systematically, %x1, %x2 %x3 etc.

No, you don't.  Whenever it looks like you want numbered variable names,
what you really want is a variable with numbered values: an array.  In
this case each element of the array will be (a reference to) a hash:

    my @x;
    for ( @column_data ) {
        my %col;
        # build %col from $_
        push @x, \ %col;
    }

Now, $x[ 0] is the first of your columns, $x[ 1] is the second, etc.
So $x[ 1]->{ gaga} would be the element of the second column whose key
is "gaga".  For more about access through references, see perlref and
perlreftut.

Anno


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

Date: Sat, 12 Feb 2005 17:14:57 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: naming a variable with the datum from another variable
Message-Id: <lQqPd.3146$uc.634@trnddc01>

Duncan Harris wrote:
> I need to create a separate associative array for each column of data
> that I have. However, the number of columns varies.  I wish to name
> these arrays systematically, %x1, %x2 %x3 etc.

Don't. What you are trying to do is called symbolic references and it has 
all kinds of very bad implications. See DejaNews (aka Google) for numerous 
previous discussions about this topic.
Also I strongly recommend to read the FAQ entry "How can I use a variable as 
a variable name?". It also tells you how to use the proper Perl data 
structures instead.

> I wish to use a for loop to go through each of these in order and
> process them.

No need to use symbolic references for loops. Just the opposite. With the 
proper data structure (e.g. an array of hashes) you just loop through the 
content of the top array without ever bothering about that those are 
references

> How can I write the name of the variable %x# where # represents is the
> counter for the loop?

No need for a counter. Just do
    for (@everything) {
        proccess_column($_);
    }

jue 




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

Date: Sat, 12 Feb 2005 17:50:45 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: naming a variable with the datum from another variable
Message-Id: <U-Gdnew3OsnaFZPfRVn-gg@comcast.com>

Duncan Harris wrote:

> I need to create a separate associative array for each column of data
> that I have. However, the number of columns varies.  I wish to name
> these arrays systematically, %x1, %x2 %x3 etc.
> 
> I wish to use a for loop to go through each of these in order and
> process them.
> 
> How can I write the name of the variable %x# where # represents is the
> counter for the loop?
> 
> (I know about for loops already and am writing a script).
> 
> Thanks in advance for any help.

You need to be using an array of hashes.

foreach my $i (@x) {
  foreach my $j (sort(keys %$i)) {
    do_something($i{$j});
  }
}

See perldoc perllol for more information about how to
use references to make such nested data structures.  It
talks in terms of an array of arrays, but the principle's
mostly the same.

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: Sat, 12 Feb 2005 03:09:35 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: new to group, need a temperature perl script.
Message-Id: <N9OdndDgKf5vfpDfRVn-3w@comcast.com>

Matthew Lock wrote:
> A. Sinan Unur wrote:
> 
>>It is not as bad as using Google groups.
>  
> Just wondering what's so bad about Google Groups?

It corrupts perl code that uses "@".
Both "exampleusername@example.com" and {@a=@hash{@keys} get mangled.
	-Joe


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

Date: 12 Feb 2005 10:02:38 -0800
From: "JNye" <nyejeff@yahoo.com>
Subject: perl extension promblem Can't find 'boot_<blah>' symbol in .so
Message-Id: <1108231358.177826.173520@f14g2000cwb.googlegroups.com>

I'm attempting to use the perl extension mechanism, h2xs,xsubpp, etc.

I receive this error message at run time:
Can't find 'boot_DefRd2' symbol in
<snipped>/DefRd2/blib/arch/auto/DefRd2/DefRd2.so

DefRd2 is my package.

I have three routines called from a test program, dft.pl:
 - a straight perl call to a perl sub DefRd2.pm,
 - a call to a C extension, where C code is above the
   module/package statement in the xs file
 - a linked C call, specified in the xs file but C code is
   in an external .o file, linked via OBJECT in Makefile.PL
   (this C routine lives in an external file called
   LinkedCBasicTest.c)
All three routines require no arguments and return no values.
   They simply print a string.

The straight perl call and the in-line C call work fine. The linked C
call fails with the above error message, unless
commented out.

Compilation occurs without any warnings/errors (other than those caused
by stripping out the ABSTRACT to shorten my code included below.)

Does anyone have an idea what I'm doing wrong here? Seems like a
straight forward test, I must be missing some detail somewhere.

At first I thought I was having an issue with dynamic libaries but
what's confusing is that the in-line C code works fine.

So I'm thinking either a MakeMaker misuse or xsubpp switch is missing.

Any thoughts/help would be appreciated.

=======================
Original h2xs invocation was:
h2xs -A -n DefRd2 <= my package name
=======================
DefRd2.xs contents <minus comments and such>:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
void InLineCBasicTest (void) {
   printf("In line C basic test output\n");
}
MODULE = DefRd2 PACKAGE = DefRd2

void
InLineCBasicTest()

void
LinkedCBasicTest()
=======================
The test script which contains the calls to straight perl, in-line C
and linked C was invoked as:
perl -Mblib dft.pl
=======================
dft.pl contains:
use strict;
use warnings;
use DefRd2;
&DefRd2::InLineCBasicTest;
&DefRd2::PMPerlBasicTest;
&DefRd2::LinkedCBasicTest;
=======================
DefRd2.pm contains:
package DefRd2;
use 5.008003;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = ( 'all' => [ qw(

) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(

);
our $VERSION = '0.01';
require XSLoader;
XSLoader::load('DefRd2', $VERSION);
sub PMPerlBasicTest { print "Package perl basic test output\n"; }
1;
=======================
Makefile.PL contains:
use 5.008003;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'DefRd2',
VERSION_FROM => 'lib/DefRd2.pm',
PREREQ_PM => {},
($] >= 5.005 ?
(ABSTRACT_FROM => 'lib/DefRd2.pm',
AUTHOR => 'X X. X <'"x@x>') : ()),
LIBS => [''],
DEFINE => '',
INC => '-I.',
OBJECT => 'LinkedCBasicTest.o',
);
=======================
LinkedCBasicTest.c contains:
#include <stdio.h>
void LinkedCBasicTest (void) {
  printf("Lined c basic test output\n");
}
=======================
perl version 5.8.6 <upgraded from 5.8.3>
h2xs version 1.2.3 < same for 5.8.3 and 5.8.6> 
on RH Fedora 2



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

Date: Sat, 12 Feb 2005 21:20:16 +0000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: perl extension promblem Can't find 'boot_<blah>' symbol in .so
Message-Id: <420e829d$0$14902$5a62ac22@per-qv1-newsreader-01.iinet.net.au>

JNye wrote:
> I'm attempting to use the perl extension mechanism, h2xs,xsubpp, etc.
> 
> I receive this error message at run time:
> Can't find 'boot_DefRd2' symbol in
> <snipped>/DefRd2/blib/arch/auto/DefRd2/DefRd2.so
> 
> DefRd2 is my package.

[snip]

> =======================
> DefRd2.pm contains:
> package DefRd2;
> use 5.008003;
> use strict;
> use warnings;
> require Exporter;
> our @ISA = qw(Exporter);
> our %EXPORT_TAGS = ( 'all' => [ qw(
> 
> ) ] );
> our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
> our @EXPORT = qw(
> 
> );
> our $VERSION = '0.01';
> require XSLoader;
> XSLoader::load('DefRd2', $VERSION);
> sub PMPerlBasicTest { print "Package perl basic test output\n"; }
> 1;

I would try reverting to DynaLoader (instead of XSLoader) and see if 
that fixes the problem. According to 'perldoc XSLoader', "many (most) 
features of DynaLoader are not implemented in XSLoader".

Hth.

Cheers,
Rob


-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: 12 Feb 2005 16:39:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: track how many moves to sort an array?
Message-Id: <culbgm$kn3$1@mamenchi.zrz.TU-Berlin.DE>

Abigail  <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> Scott Bryce (sbryce@scottbryce.com) wrote on MMMMCLXXXII September
> MCMXCIII in <URL:news:UY-dneNtNqHziZHfRVn-hg@comcast.com>:
> --  Jürgen Exner wrote:
> --  
> -- > Not quite. You are counting how often two elements are compared.
> --  
> --  # Perhaps this is what the OP wanted?
> --  @list = sort {$count ++ if $a gt $b; $a cmp $b} @list;
> 
> No. That still counts compares, not moves. There's no way to count
> the number of moves from within Perl.

The "number of moves" isn't well defined in view of the various sort
algorithms.  Not every sort proceeds in place, moving elements back and
forth.  What is the number of moves a merge sort?  In a heap sort?
And how are they relevant?  An indirect sort moves every element exactly
once.

Anno


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

Date: Sat, 12 Feb 2005 08:00:51 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Web interface to Usenet (was Re: new to group, need a temperature perl script.)
Message-Id: <slrnd0s30j.905.tadmc@magna.augustmail.com>

Sherm Pendley <spamtrap@dot-app.org> wrote:
> Matthew Lock wrote:
> 
>> Just wondering what's so bad about Google Groups?


[ We are talking about _posting_ from GG here, not searching. ]


> Something about it just seems to attract trolls and
> idiots in droves - I don't know why.


I came to that conclusion about all postings from post-for-free
website interfaces to news, so I've had them scored down for several years.


> I'm just about (but not quite) to the point of just killfiling anything with
> google.com in the header.


I put -1000 in about a month ago, and was convinced to up it 
to -5000 just recently...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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