[16824] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4237 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 6 14:10:39 2000

Date: Wed, 6 Sep 2000 11:10:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <968263818-v9-i4237@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 6 Sep 2000     Volume: 9 Number: 4237

Today's topics:
        memory useage issues <gregg@barefoot.net>
        Module Compile Porblems with gcc <gebhardt@erinet.com>
    Re: newbie: redirect problem <christopher_j@uswest.net>
    Re: newbie: redirect problem (Anthony Peacock)
    Re: News group app required <christopher_j@uswest.net>
        parsing an asterisk and bracket <rocket@acme.com>
        perl & htaccess <mc@backwoods.org>
    Re: perl & htaccess nobull@mail.com
    Re: perl giving full directory path when using pipes?? <neutron@fc.hp.com>
        postscript conversion in perl aaronp243@my-deja.com
        Split up a number? split? unpack? <campbell@coaps.fsu.edu>
    Re: Split up a number? split? unpack? (Rafael Garcia-Suarez)
    Re: Split up a number? split? unpack? (Abigail)
    Re: Split up a number? split? unpack? <sariq@texas.net>
    Re: Split up a number? split? unpack? <godzilla@stomp.stomp.tokyo>
    Re: Stable sorting <bart.lateur@skynet.be>
    Re: Stable sorting <russ_jones@rac.ray.com>
    Re: Stable sorting <uri@sysarch.com>
    Re: Stable sorting (Abigail)
    Re: Stable sorting <russ_jones@rac.ray.com>
    Re: The XY problem (was Re: CGI.pm: controlling Back &  <bart.lateur@skynet.be>
    Re: turn characters into meta characters aaronp243@my-deja.com
    Re: uninitialized value - but I have initilised it! Hav <christopher_j@uswest.net>
    Re: uninitialized value - but I have initilised it! Hav <uri@sysarch.com>
    Re: why does foreach iterate on an undef variable? <tina@streetmail.com>
    Re: World Wide PERL PROGRAMMERS TELECOMMUTE (Nobody)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 06 Sep 2000 17:39:55 GMT
From: "J. Gregg Thomason" <gregg@barefoot.net>
Subject: memory useage issues
Message-Id: <39B6816A.69537D82@barefoot.net>

I have a script:
open (doc1,"file.dat") or die "can't open file: $!";
print "Hashing file\n";
for ($x=1;$x<=10000;$x++)
{
  my @flds=split("\t");
  my $pid=shift @flds;
  $phys{$pid}=\@flds;
}

print "file Hashed\n";
close(doc1);
open (doc2,"file2.dat") or die "can't open file: $!";
open (docout,">file2.txt") or die "can't open output file: $!";
print "Adding other table";
for ($x=1;$x<=10000;$x++)
{
  my @flds=split("\t");
  my $pid=@flds[1];

  if $phys{$pid}[0] eq ""
{
  my @flds=split("\t");
  my $pid=@flds[1];

  if $phys{$pid}[0] eq ""
  {
    $outline="LBB";
    $phone = @flds[8] + @flds[9];
    $outline = join("\t", $outline, $pid, @flds[0], $phys{$pid}->[2],
      $phys{$pid}->[3], $phys{$pid}->[1], $phys{$pid}->[4],
$phys{$pid}->[5],
          @flds[2], @flds[10], @flds[4], @flds[5], @flds[6], "\n");

    print (docout $outline);
  }
}
print "Done!";

This is killing memory on my machine; granted its an older Linux box
(kernel 2.0.36,
perl -v reports This is perl, version 5.005_03 built for i386-linux,
64MB RAM and 64MB swap). Memory drops to well under a meg, swap shrinks,
then it chokes and dies. I need to eventually "port" this to Solaris, on
a more stout machine; but the sizes of the input files (currently 13
megs, and thats just test data, the production data will be 70-100 meg
files) will grow too.

What my question is, then, is how can I perform the operation (reading
in 2 files, munging the data, creating an outfile) with immense input
files without resorting to the old "throw hardware at it" solution? I
considered using Data::Dumper (or something similar) to try and store
away what I didn't need so it doesn't get held in memory, but I fear
that'll create a performance hit even if it works, which I can't afford
(of course the script doesn't complete at this point so thats better
than nothing). What's the best way to 'conserve' memory? How can I make
the most use of the available RAM?

Many thanks in advance, hope I gave enough info,

--gregg





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

Date: Wed, 06 Sep 2000 12:36:11 -0400
From: JG <gebhardt@erinet.com>
Subject: Module Compile Porblems with gcc
Message-Id: <39B6727B.9E8BAC20@erinet.com>

I am trying to compile perl module DBI-1.13 on HPUX 11. I orginally had
"cc" as the compiler in Config.pm. The make failed with:

-A is only available with C/ANSI C compiler
-0 is only available with C/ANSI C compiler
+Onolimit is only available with C/ANSI C compiler
+z is only available with C/ANSI C compiler

I then installed gcc thinking that this would help. But no, it gave me
the errors
   /opt/perl5/bin/perl -p -e "s/~DRIVER~/Perl/g" <
blib/arch/auto/DBI/Driver.xst > Perl.xsi
        /opt/perl5/bin/perl -I/opt/perl5/lib/5.00503/PA-RISC1.1
-I/opt/perl5/lib/5.00503 /opt/perl5/lib/5.00503/ExtUtils/xsubpp  -tc
        gcc -c  -Ae -O +Onolimit     -DVERSION=\"1.13\"
-DXS_VERSION=\"1.13\" +z -I/opt/perl5/lib/5.00503/PA-RISC1.1/CORE -Wall
-Wc
gcc: +Onolimit: No such file or directory
gcc: +z: No such file or directory
*Initialization*:1: missing token-sequence in `#assert'
*** Error exit code 1
Stop.

I then removed the option -O onolimit and the +z from the Makefile and
got this error:

      gcc -c  -Ae -O     -DVERSION=\"1.13\"  -DXS_VERSION=\"1.13\"
-I/opt/perl5/lib/5.00503/PA-RISC1.1/CORE -Wall -Wno-comment -c
*Initialization*:1: missing token-sequence in `#assert'
*** Error exit code 1

Can anybody help me out on this? Can I just make changes to the
Config.pm file to prevent this from happening in the future?



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

Date: Wed, 6 Sep 2000 10:01:02 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: newbie: redirect problem
Message-Id: <cLut5.2003$Xq2.164231@news.uswest.net>

As others have said, all you need is:

print "Location: http://www.newlocation.com\n\n";

or,

print "Location: http://www.newlocation.com\n";
print "\n";

(which I like to use sometimes).

Keep in mind that this is _all_ you need to print.  This is
part of the http header, so don't print out any of yer
fancy shmancy CGI.pm based shtuff.




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

Date: 6 Sep 2000 17:13:26 GMT
From: a.peacock@chime.ucl.ac.uk (Anthony Peacock)
Subject: Re: newbie: redirect problem
Message-Id: <8p5tvm$gae$1@uns-a.ucl.ac.uk>

In article <cLut5.2003$Xq2.164231@news.uswest.net>, christopher_j@uswest.net 
says...
>
>As others have said, all you need is:
>
>print "Location: http://www.newlocation.com\n\n";
>
>or,
>
>print "Location: http://www.newlocation.com\n";
>print "\n";

Or even better:

print "Location: http://www.newlocation.com/\n\n";



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

Date: Wed, 6 Sep 2000 08:35:25 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: News group app required
Message-Id: <Xutt5.1780$Xq2.128517@news.uswest.net>


"Derek Lavine" <derek@realware.com.au> wrote:
> Hi all,
>
> I have a client that would like to have a news forum hosted on their
> site, for their customers. They want to provide a means for their
> customers to post questions/answers on monitored threads but all via
> their web site.
>
> Is anyone aware of a product out there that is not expensive and for
> which source code is available.
>
> Also the same client would like to provide a personal calender service to
> their customers, so there customers are able to receive email
> notification about things at times that they request. Again I would
> require the source code as we would need to customise things.


I suggest using a forum system.  There are many of them out there
and they can really help spruce up a site.  You can mod / admin
them to different levels (all the way from "I don't give a f*ck" to
"I am the lord high commander of the gestapo").  Try UBB
"http://www.ultimatebb.com", which uses perl (it works well but it
has a prety high cpu usage), vBulletin "http://www.vbulletin.com",
which uses PHP and MySQL, or UltraBoard "http://www.ub2k.com/" which
uses Perl and MySQL.  All of these are fairly cheap (vBulletin and
UltraBoard are the cheapest, both less than 40 bucks) and highly
functional.




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

Date: Wed, 06 Sep 2000 10:05:18 -0700
From: JakeRocket <rocket@acme.com>
Subject: parsing an asterisk and bracket
Message-Id: <E4E987713C66D1B5.40175B90354AEA51.368E47CE0F27517E@lp.airnews.net>

I am having probs on a search and replace in a file I am trying to
modify.

usng the following line in a while loop chokes 
$myline =~ s/\[\//g;

I am trying to nuke the bracket, but the script retruns an error about
the missing right bracket.

Also, I am having a hard time finding the proper way to remove an
asterisk in the same manner.




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

Date: Wed, 06 Sep 2000 11:25:19 -0400
From: MC <mc@backwoods.org>
Subject: perl & htaccess
Message-Id: <39B661DF.22ED7928@backwoods.org>

Two questions:

1) can a perl script determine what login was used to enter an htaccess
protected site?

2) can a perl script add a user/pwd to an htaccess file ?

for both question the (hopefully) obvious HOW? also applies.

Thanks in advance. MC

-- 
---------------------------------------------------------------------
My email address(s) are my private property.  They are NOT to be used
or recorded for ANY reason without my explicit permission.  Disregard
of this statement is in violation of federal privacy & copyright law.
---------------------------------------------------------------------
"The world wont end with a bang, or even a whimper, but with an error
message." -- format C:


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

Date: 06 Sep 2000 17:52:55 +0100
From: nobull@mail.com
Subject: Re: perl & htaccess
Message-Id: <u9snrd31js.fsf@wcl-l.bham.ac.uk>

MC <mc@backwoods.org> writes:
 
> 1) can a perl script determine what login was used to enter an htaccess
> protected site?

A CGI script that resides _within_ a protected area of a site is told
the username.  Whether the script is writen in Perl or some other
language is irrelvant. See generic CGI documentation or documentation
of the Perl module GCI.pm - look for things with "user" in them. 

> 2) can a perl script add a user/pwd to an htaccess file ?

Perl is a very good language for adding a line to a text file.  For
details see FAQ.

> for both question the (hopefully) obvious HOW? also applies.

Sorry, no fish here! We just give you a rod and a hard shove in the
direction of the river (if you fall in we try not to laugh too loud).

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


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

Date: 6 Sep 2000 15:42:10 GMT
From: Jack Applin <neutron@fc.hp.com>
Subject: Re: perl giving full directory path when using pipes??
Message-Id: <8p5oki$q9p$1@fcnews.fc.hp.com>

d <you@somehost.somedomain> wrote:
> I am running perl5.004 on an HP 10.20.

> When I use a pipe in a unix statement such as

> $test=`cat $file | wc -l`;

> It will return the full directory path that I am in and
> the answer.  such as

> /opt/ns-ftrack/docs/test
> 3

There's a command in your .kshrc or .profile or /etc/profile or some
other startup file that prints out the current directory.  Look at the
output when you first log in or start a shell--does it print the
currrent directory?

Since perl invokes a shell to do the `` command, all the output of the
shell, including the line that you don't want, gets returned to you.

-- 
Jack Applin
neutron@fc.hp.com


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

Date: Wed, 06 Sep 2000 16:02:14 GMT
From: aaronp243@my-deja.com
Subject: postscript conversion in perl
Message-Id: <8p5ppn$pad$1@nnrp1.deja.com>

I have PostScript files that are set to be printed as portrait, but I
need to convert them all to landscape.  I would like to do it in perl,
does anyone have any ideas as to how to do this?  Thanks in advance!

-Aaron


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 06 Sep 2000 11:30:30 -0400
From: Stacey Campbell <campbell@coaps.fsu.edu>
Subject: Split up a number? split? unpack?
Message-Id: <39B66315.2CF95C9E@coaps.fsu.edu>

I have a data file that has one field with six quality control flags.
One example is 223252.  Each digit means something.

How do I split it up?  I can't get split to split on digits, and I don't
think I'm using the 'unpack' function properly.  Would it be easiest to
use regular expressions to get the first number and keep replacing the
first number with nothing until I get every number?

-Stacey-




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

Date: Wed, 06 Sep 2000 16:03:54 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Split up a number? split? unpack?
Message-Id: <slrn8rcr2s.2jt.rgarciasuarez@rafael.kazibao.net>

Stacey Campbell wrote in comp.lang.perl.misc:
>I have a data file that has one field with six quality control flags.
>One example is 223252.  Each digit means something.
>
>How do I split it up?  I can't get split to split on digits, and I don't
>think I'm using the 'unpack' function properly.  Would it be easiest to
>use regular expressions to get the first number and keep replacing the
>first number with nothing until I get every number?

Split on nothing:
  my @digits = split '' => '223252';

-- 
Rafael Garcia-Suarez
rgarciasuarez.free.fr


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

Date: 06 Sep 2000 12:06:29 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Split up a number? split? unpack?
Message-Id: <slrn8rcqqc.tjm.abigail@alexandra.foad.org>

Stacey Campbell (campbell@coaps.fsu.edu) wrote on MMDLXIII September
MCMXCIII in <URL:news:39B66315.2CF95C9E@coaps.fsu.edu>:
\\ I have a data file that has one field with six quality control flags.
\\ One example is 223252.  Each digit means something.
\\ 
\\ How do I split it up?  I can't get split to split on digits, and I don't
\\ think I'm using the 'unpack' function properly.  Would it be easiest to
\\ use regular expressions to get the first number and keep replacing the
\\ first number with nothing until I get every number?


One could use unpack, but split is the canonical idiom. Only use unpack
if you're doing this in a loop that's the bottleneck of your program.

As for splitting, you don't want to split on digits - you want to preserve
them. Here's a hint: you want to split on what's between the digits.



Abigail
-- 
sub J::FETCH{Just   }$_.='print+"@{[map';sub J::TIESCALAR{bless\my$J,J}
sub A::FETCH{Another}$_.='{tie my($x),$';sub A::TIESCALAR{bless\my$A,A}
sub P::FETCH{Perl   }$_.='_;$x}qw/J A P';sub P::TIESCALAR{bless\my$P,P}
sub H::FETCH{Hacker }$_.=' H/]}\n"';eval;sub H::TIESCALAR{bless\my$H,H}


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

Date: Wed, 06 Sep 2000 11:11:14 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Split up a number? split? unpack?
Message-Id: <39B66CA2.9366EEDD@texas.net>

Stacey Campbell wrote:
> 
> I have a data file that has one field with six quality control flags.
> One example is 223252.  Each digit means something.
> 
> How do I split it up?

split() on the null pattern.

If $_ holds the string:

my @qc_flags = split //;

- Tom


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

Date: Wed, 06 Sep 2000 09:22:26 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Split up a number? split? unpack?
Message-Id: <39B66F42.78A83F14@stomp.stomp.tokyo>

Stacey Campbell wrote:
 
> I have a data file that has one field with six quality 
> control flags. One example is 223252.  Each digit means
> something.
 
> How do I split it up?  I can't get split to split on digits,
> and I don't think I'm using the 'unpack' function properly.
> Would it be easiest to use regular expressions to get the 
> first number and keep replacing the first number with nothing
> until I get every number?


Split up your field on nothing. 

split (//, $string)

For this example, // is simply two forward slashes
with nothing between. Spilt on nothing!


Godzilla!
-- 
Shazamina Fatima Alabimbo, Internet Mind Reader.
  http://la.znet.com/~callgirl/mindread.cgi


TEST SCRIPT:
____________

#!/usr/local/bin/perl

print "Content-type: text/plain\n\n";

my ($string) = "223252";

my ($q1, $q2, $q3, $q4, $q5, $q6) = split (//, $string);

print "Input: \n  $string\n\n";

print "Output: 
  Quality Flag One:   $q1
  Quality Flag Two:   $q2
  Quality Flag Three: $q3
  Quality Flag Four:  $q4
  Quality Flag Five:  $q5
  Quality Flag Six:   $q6";

exit;



PRINTED RESULTS:
________________

Input: 
  223252

Output: 
  Quality Flag One:   2
  Quality Flag Two:   2
  Quality Flag Three: 3
  Quality Flag Four:  2
  Quality Flag Five:  5
  Quality Flag Six:   2


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

Date: Wed, 06 Sep 2000 15:26:03 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Stable sorting
Message-Id: <deocrsoae1tf1qodacem7612meghase3g4@4ax.com>

Randal L. Schwartz wrote:

> Abigail wrote:
>>> 
>>> Perl 5.7.0 uses merge sort to implement sort(). Merge sort is stable.
>>> 

>5.6.1 will most likely keep this feature.  And 5.6.1 should be more
>stable than either 5.6.0 or 5.7.0 (one would hope).

Nice to know. To bad that my scripts will have to work on slightly
outdated perls (5.005 and 5.6), too. Not every single target machine is
under my control.

-- 
	Bart.


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

Date: Wed, 06 Sep 2000 10:21:18 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Stable sorting
Message-Id: <39B660EE.2E76846@rac.ray.com>

Abigail wrote:
> 
> Russ Jones (russ_jones@rac.ray.com) wrote on MMDLXIII September MCMXCIII
> in <URL:news:39B6428D.6F563236@rac.ray.com>:
> $$ Abigail wrote:
> $$ >
> $$ > Perl 5.7.0 uses merge sort to implement sort(). Merge sort is stable.
> $$
> $$
> $$ But Perl 5.7.0 isn't. That Catch 22, that's one hell of a catch.
> 
>     $ /opt/devperl/bin/perl -v | grep built
>     This is perl, v5.7.0 built for i686-linux-64int-ld
>     $
> 
> I don't quite see your point. Sure, 5.7.0 isn't stable. But 5.7.x leads
> to 5.8.x which _will_ be stable.
> 

	$ /opt/perl5/bin/perl -v | grep built
	This is perl, v5.6.0 built for PA-RISC2.0
	$

What does that prove? 

But I get your point. I think. It was just an observation, not a
recommendation, right?

I used to support dfsort and SyncSort on MVS in a very large shop.
Those products both have a runtime switch that can be used to turn on
or off the function that preserves the original order of equally keyed
records. By default, that function is turned off in most shops because
it requires significant extra processing to create and sort on a
secondary "original sequence" key, as has been hinted at in several
previous posts in this thread. I remember doing metrics on massive
amounts of JCL, looking to see who was using this function, and as I
recall, it was specified in something under 1% of all the production
jobs in the shop, which amounted to some 30,000 sort steps. 

I'd hope that any implementation of "sort" in Perl would not preserve
the order of equally keyed records by default, although I'd like to
see it as an option. In most cases, though, it would be a solution
looking for a problem that just didn't exist.

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Wed, 06 Sep 2000 15:47:37 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Stable sorting
Message-Id: <x7bsy1ldye.fsf@home.sysarch.com>

>>>>> "RJ" == Russ Jones <russ_jones@rac.ray.com> writes:

  RJ> Abigail wrote:
  >> 
  >> $$ > Perl 5.7.0 uses merge sort to implement sort(). Merge sort is stable.

  RJ> I'd hope that any implementation of "sort" in Perl would not preserve
  RJ> the order of equally keyed records by default, although I'd like to
  RJ> see it as an option. In most cases, though, it would be a solution
  RJ> looking for a problem that just didn't exist.

the merge sort algorithm itself is stable. you can't turn that feature
off. it doesn't have any effect on efficiency.

the sorts you were using were inherently unstable so they had to add the
stable option which slowed it down.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 06 Sep 2000 12:00:45 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Stable sorting
Message-Id: <slrn8rcqfh.tjm.abigail@alexandra.foad.org>

Russ Jones (russ_jones@rac.ray.com) wrote on MMDLXIII September MCMXCIII
in <URL:news:39B660EE.2E76846@rac.ray.com>:
?? 
?? I used to support dfsort and SyncSort on MVS in a very large shop.
?? Those products both have a runtime switch that can be used to turn on
?? or off the function that preserves the original order of equally keyed
?? records. By default, that function is turned off in most shops because
?? it requires significant extra processing to create and sort on a
?? secondary "original sequence" key, as has been hinted at in several
?? previous posts in this thread. I remember doing metrics on massive
?? amounts of JCL, looking to see who was using this function, and as I
?? recall, it was specified in something under 1% of all the production
?? jobs in the shop, which amounted to some 30,000 sort steps. 
?? 
?? I'd hope that any implementation of "sort" in Perl would not preserve
?? the order of equally keyed records by default, although I'd like to
?? see it as an option. In most cases, though, it would be a solution
?? looking for a problem that just didn't exist.


What an absurd requirement. If you don't want to preserve order, shuffle
your data first. It's a trivial exercise to prove that merge sort is stable.
No additional processing required.


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: Wed, 06 Sep 2000 12:02:44 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Stable sorting
Message-Id: <39B678B4.EA829997@rac.ray.com>

Abigail wrote:
> 
> ?? I'd hope that any implementation of "sort" in Perl would not preserve
> ?? the order of equally keyed records by default, although I'd like to
> ?? see it as an option. In most cases, though, it would be a solution
> ?? looking for a problem that just didn't exist.
> 
> What an absurd requirement. If you don't want to preserve order, shuffle
> your data first. It's a trivial exercise to prove that merge sort is stable.
> No additional processing required.
> 

You just don't get it, do you?

I don't dispute that merge sort is "stable." I don't actually know
that it is, but if you say so, I'm prepared to believe you. I don't
care how trivial it is to prove it. If you say it's so, that's enough
proof for me.

It IS absurd, though, and a bit insulting, for you to think that I
have a requirement that equally keyed records MUST NOT be in the same
order as they were in the original file. I just don't usually care
what order they end up in, as long as they are properly sorted by
their sort key(s). It just doesn't matter, in nearly all applications.

But is merge sort more efficient sorting a file with a large number of
equally keyed records than some other sort that doesn't have to keep
those records in their original order? Why spend the cycles doing the
extra ordering for every one of your sorts when it's rarely needed?
Why not just turn that feature on when you need it?

There is no one-size-fits-all sort. I'll grant that for most of the
sorts that I've seen implemented from inside a Perl script, it really
doesn't matter which sort you use, as long as your data gets sorted.
But on really big sorts, where you're sorting many billions of records
on multiple ascending and descending keys, the sorting algorithm your
program uses can make a significant difference in the resources
required, and artificially ordering records that didn't need to be
ordered in the first place is a waste of resources.

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Wed, 06 Sep 2000 15:29:50 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: The XY problem (was Re: CGI.pm: controlling Back & Reload)
Message-Id: <bkocrs0rtjcuh95l96pdbatffbpu1plk4h@4ax.com>

Randal L. Schwartz wrote:

>Alan> This looks to me to be another case of "premature closure": the
>Alan> questioner wanted to solve some not very clearly stated X, they
>Alan> concluded that Y and Z were components of a solution, and now they're
>Alan> asking how to implement Y and Z.

>On IRC chatting (EFnet #perl, to be precise), we call this an "XY
>problem" for shorthand.

>It's important for me as a person who's been on the listening end of
>questions for many years, and who has to listen professionally (and
>most of the time answer professionally) to realize that all problems
>are pieces of solutions to larger problems.

Too bad that the actual, more general problem, X, is usually not
considered an appropriate topic for this newsgroup. Y has more of a
chance to look like a Perl problem.

-- 
	Bart.


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

Date: Wed, 06 Sep 2000 16:06:25 GMT
From: aaronp243@my-deja.com
Subject: Re: turn characters into meta characters
Message-Id: <8p5q1f$plb$1@nnrp1.deja.com>

In article <MPG.1415e37227b2505a98acf6@nntp.hpl.hp.com>,
  Larry Rosler <lr@hpl.hp.com> wrote:
> In article <MPG.1416d7a88bfbb356989721@localhost> on Tue, 29 Aug 2000
> 22:33:24 GMT, jason <elephant@squirrelgroup.com> says...
>
> ...
>
> > don't forget that a string is a valid Perl statement .. so you need
only
>                                              ^^^^^^^^^
>     s/statement/expression/;
>
> > do
> >
> >   my $foo = '*\t*\n*\t*';
> >   $foo = eval qq("$foo");
> >   print $foo;
>
> But, as I have shown, hash lookup is *lots* faster.
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>

Yes, a hash look up is faster, however, I did not want to hard code the
values.  Putting the values in a hash would require me to hard code the
escape sequences.  The application that I am using this in is small
enough that I do not need to have them that fast.

-Aaron


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 6 Sep 2000 10:44:18 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: uninitialized value - but I have initilised it! Haven't I?
Message-Id: <Lnvt5.2245$Xq2.182262@news.uswest.net>

Argh!  Why are you doing this anyway?!

Use CGI.pm or cgi-lib.pl to get your parameters!


require 'cgi-lib.pl';    # it's free, it's in every perl distro, use it!

ReadParse();

# now all your parameters are in a hash called %in
# for example, http://blah.com/myscript.pl?somevar=someval
#  will give you $in{'somevar'} = 'someval';
#  spiffy eh?




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

Date: Wed, 06 Sep 2000 17:53:01 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: uninitialized value - but I have initilised it! Haven't I?
Message-Id: <x74s3tl85e.fsf@home.sysarch.com>

>>>>> "CMJ" == Christopher M Jones <christopher_j@uswest.net> writes:

  CMJ> Argh!  Why are you doing this anyway?!
  CMJ> Use CGI.pm or cgi-lib.pl to get your parameters!


  CMJ> require 'cgi-lib.pl';    # it's free, it's in every perl distro, use it!

huh? it is not in any perl distribution. CGI.pm is.

and CGI.pm has a cgi-lib compatibility mode.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 6 Sep 2000 17:45:43 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: why does foreach iterate on an undef variable?
Message-Id: <8p5vs7$c7aol$2@ID-24002.news.cis.dfn.de>

hi,
In comp.lang.perl.misc Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> [reordered post to respect the natural flow of time, which makes it a
> bit easier to follow]

> On Wed, 06 Sep 2000 09:10:44 GMT,
> 	Paul Johnston <johnston.p@worldnet.att.net> wrote:
>> Paul Johnston wrote in message ...
>> >I'm confused as to the logic of why a foreach loop block *is* entered when
>> >the LIST is undef (NOT expected), but *is not* when the LIST is an empty
>> >array (expected behavior):

> I think this is where the confusion starts. A list cannot be undefined,

no? well, it doesn't work with
@array = undef;
but with
undef @array;

of course in the most cases people want to prefer my();

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: 6 Sep 2000 17:24:55 GMT
From: nobody@contract.East.Sun.COM (Nobody)
Subject: Re: World Wide PERL PROGRAMMERS TELECOMMUTE
Message-Id: <8p5ul7$82o$1@eastnews1.east.sun.com>

In article <39b58510.949281684@news.ionet.net>, Maggert <mag@ionet.net> wrote:
>On Tue, 05 Sep 2000 17:35:51 GMT, Uri Guttman <uri@sysarch.com> wrote:
>
>>>>>>> "P" == PERLWorldWidel  <PERLWorldWidel@GLOBALTelecommute.com> writes:
>>
>>  P> $15.00 to $25.00 per hour commensurate with experience.
>>
>>HAHAHAHAHHAHAHAAHAH!!
>
>	Hey I saw an add for perl programmers for a whopping $8 bucks
>an hour!!! They did have a TV and several game players like Sega and
>Nintendo. And their own office!!! This was also in NYC!!!! 
>
>
Heck, my little brother makes more than that at his no-brainer job at
Blockbuster Video.  Seriously, though, my minimum hourly consulting
rate right now is $80/hour...and I still have more work available than
I can possibly do.  (note:  this is in the Metro Boston area)

Anita
(working 3 contracts and seriously looking forward to that 3-week vacation
in New Zealand :-)

>MP




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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