[15871] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3284 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 7 21:10:29 2000

Date: Wed, 7 Jun 2000 18:10:18 -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: <960426618-v9-i3284@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 7 Jun 2000     Volume: 9 Number: 3284

Today's topics:
    Re: Perl and memory consumption <dan@tuatha.sidhe.org>
    Re: Perl and memory consumption (Andrew Johnson)
    Re: Perl and memory consumption <jkline@one.net>
    Re: Perl and memory consumption <godzilla@stomp.stomp.tokyo>
    Re: Perl and memory consumption <elaine@chaos.wustl.edu>
    Re: Perl and memory consumption <bkennedy@hmsonline.com>
    Re: Perl and memory consumption (Gwyn Judd)
        Perl cgi html programmer needed for Atlanta kpulliam@my-deja.com
    Re: Perl Shortcut? (James Weisberg)
    Re: Perl Shortcut? (Abigail)
    Re: Perl unusable as a programming language (Jonadab the Unsightly One)
    Re: Perl's evaluation order for a logical expression (Tad McClellan)
    Re: perldoc & perlop man page? <lauren_smith13@hotmail.com>
        PLEASE HELP - PLEASE READ <hfucek@zg.hinet.hr>
    Re: PLEASE HELP - PLEASE READ <care227@attglobal.net>
        RFC: Perl module ESplit.pm now available <h.camp@scm.de>
    Re: string help needed (Craig Berry)
    Re: Text Sorting Question <dmitryp@attglobal.net>
    Re: Text Sorting Question <lr@hpl.hp.com>
        unimplented flock() running ActivePerl win98 (Kevin Ferron)
    Re: unimplented flock() running ActivePerl win98 <lauren_smith13@hotmail.com>
        web-based ppm broken? atramos_us@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 07 Jun 2000 22:37:09 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl and memory consumption
Message-Id: <p8A%4.104991$hT2.422914@news1.rdc1.ct.home.com>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Dan Sugalski wrote:
>  
>> Gojira <godzilla@stomp.stomp.tokyo> said, for some ason:
>> > Dan Sugalski wrote:
>> >> Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>> >> > |Odo| wrote:

>> The only place you will see extra overhead is if the 
>> module brings in code you don't need. That is a legitimate
>> issue, certainly, 

> Not so difficult to be realistic, yes?

Apparently so, because this:

> So, yes there are common circumstances when
> a module will bloat your memory by a very
> significant percentage factor. I will stand
> by my loose, rough, unscientific guesstimation,
> averaging all modules together, you can expect
> a bloat factor of one-thousand percent.

is not realistic. You're pulling that factor of 10 number out of thin air,
with absolutely *no* (Heck, _admittedly_ no) proof. Yes, some modules have
more code in them than you need, but you're painting with an amazingly
too-broad brush.

I stand by my statement. Modules are not inherently bloated. If you have
an argument with particular modules then it means that those modules may
be inappropriate for your needs, not that modules are inherently bad.

> Perhaps then, what I have suggested, is very
> valid advice; don't use a module unless you
> have a darn good reason.

Actually no, it's not. You're recommending that folks not make use of
prebuilt, tested libraries of code, and that's bad. Modules have code to
handle many of the tricky things programmers need (database integration,
network protocols, time and date handling, CGI form processing,
cryptography, file compression) to do and get wrong very often when they
try and invent them from scratch. It's also a huge waste of time for the
programmer to have to re-invent that stuff *again*, especially if it's not
in an area of his or her expertise.

You can, I suppose, use cut-n-paste code, but that's error-prone, hard to
maintain when you've found a bug in code that's been used a dozen or more
times, and hard to ugrade with new functionality or efficiency.

Sticking the code in a file and loading it with do or require it would
normally be an option, but that's a module so we can't do that.

					Dan


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

Date: Wed, 07 Jun 2000 23:12:47 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Perl and memory consumption
Message-Id: <PFA%4.3531$55.42464@news1.rdc1.mb.home.com>

In article <393EC33E.AB9C2DFF@stomp.stomp.tokyo>,
 Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
[snip] 
> So, yes there are common circumstances when
> a module will bloat your memory by a very
> significant percentage factor. I will stand
> by my loose, rough, unscientific guesstimation,
> averaging all modules together, you can expect
> a bloat factor of one-thousand percent.

At least the descriptors: 'loose', 'rough', and 'unscientific'
are accurate :-)

But I propose that the whole notion of averaging bloat across
modules -- even if you could factor in some sort of 'average usage'
case for each module -- is meaningless. Modules must be assessed on
an individual basis in relation to the task at hand. Loading some
date module may be overkill if all I want to do is compare two dates
together, but if my task involves lots of date calculations and
conversions, time deltas in business days, and perhaps other date
related things, then perhaps loading a date module is entirely
appropriate. What's more, some modules implement some things in C and
may run orders of magnitude faster than if the same functionality
were implemented in pure Perl.

Not to mention the fact that there are many situations where the
programmmer cares a great deal more about their implementation time
than the bloat or running time of the program in question -- using a
module that has already been looked at, tested, and used by many
people can save me a great deal of implementation and debugging time,
and I'm not going to trade that off for space and/or time efficiency
until the need really arises.

> Perhaps then, what I have suggested, is very
> valid advice; don't use a module unless you
> have a darn good reason.

Perhaps, then, you won't mind if I counter your advice with some of
my own: If a module is available that does what you want then use it
*unless* you have a darn good reason not too.

regards,
andrew

-- 
Andrew L. Johnson   http://members.home.net/perl-epwp/
      But puzzles in programming are what make it challenging and fun
      sometimes... you always end up learning one more way not to do
      something each time.  -- Brad Fenwick


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

Date: Wed, 07 Jun 2000 19:42:57 -0400
From: Joe Kline <jkline@one.net>
Subject: Re: Perl and memory consumption
Message-Id: <393EDE01.3BBD6AC4@one.net>

<SNIP code bloat, modules, etc....>

How can someone be so against modules? Aren't they roughly analagous
to #includes in C? At least that's how I've come to understand them.
(I learned Perl before I started learning about C/C++).

They nicely encapsulate functionality that I may not have the time to
learn in the short term. I could also use them to learn about that bit
of functionality.

Can big modules cause that severe of performance problems? I get lazy
and slide in the all of CGI.pm, but I've been a-changin' my ways after
reading the discourse of such individuals as brian d foy, Alan
Flavell, and others.

However, I'm a huge fan of modules. I purposefully use them for
functionality I use over and over and over and over again. It makes it
snap to handle problems with that functionality, I just have to be a
little careful with the function interfaces. No big deal if you think
about your design.

Of course that's just my opinion, I could be wrong.

joe


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

Date: Wed, 07 Jun 2000 17:00:28 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Perl and memory consumption
Message-Id: <393EE21C.9957FA60@stomp.stomp.tokyo>

Andrew Johnson wrote:
> In article <393EC33E.AB9C2DFF@stomp.stomp.tokyo>,
>  Godzilla! <godzilla@stomp.stomp.tokyo> wrote:

> > So, yes there are common circumstances when
> > a module will bloat your memory by a very
> > significant percentage factor. I will stand
> > by my loose, rough, unscientific guesstimation,
> > averaging all modules together, you can expect
> > a bloat factor of one-thousand percent.
 
> At least the descriptors: 'loose', 'rough', and 'unscientific'
> are accurate :-)

Accuracy is imperative. This is why I choose counting
blinks of my eyes over inaccurate benchmarking. However,
guesstimation is of greater accuracy.
 
> But I propose that the whole notion of averaging bloat across
> modules -- even if you could factor in some sort of 'average usage'
> case for each module -- is meaningless.

Not with this accuracy I have afforded.

> Modules must be assessed on an individual basis in relation
> to the task at hand.

Yes, this is realisitic. So far, I have been very fortunate
to find one module of all modules worth using; LWP Simple.

> Loading some date module may be overkill

Yes, and accurate averages show modules bloat
your memory use by one-thousand percent. This
is your personal memory use in trying to remember
how to get a module to work right.

> if all I want to do is compare two dates

Do you prefer blonds or brunettes?
I am a brunette but unavailable, mostly.

> but if my task involves lots of date calculations and
> conversions, time deltas in business days, and perhaps
> other date related things, 

This seems a lot of work to expend simply to
decide which date you want to entertain for
an evening. Flip a coin?

> until the need really arises.

With men, this seems a moment-by-moment condition.
 
> > Perhaps then, what I have suggested, is very
> > valid advice; don't use a module unless you
> > have a darn good reason.
 
> Perhaps, then, you won't mind if I counter your 
> advice with some of my own: If a module is available
> that does what you want then use it *unless* you have
> a darn good reason not too.

Yeah, I have pretty good reasons for not using
modules, save for the one I like and mentioned.
My reasons are I have no need for memory bloating
modules, don't care for all the bugs and problems
modules introduce, wouldn't care to pay additional
operating expenses, not to mention modules slowing
down my hot rod programs, which I mentioned anyhow.

Avoid modules. Save some time and money. You can 
spend both on whichever date you decide to graciously
entertain for an evening, and brag about what a skilled
programmer you are with no need for modules. Shirley she
will understand this and be impressed right out of her 
spandex pants.

I wouldn't mention this to your wife however.


Godzilla!


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

Date: Thu, 08 Jun 2000 00:33:08 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Perl and memory consumption
Message-Id: <B5646201.5B49%elaine@chaos.wustl.edu>

in article 393EB961.6C84E29E@stomp.stomp.tokyo, Godzilla! at
godzilla@stomp.stomp.tokyo quoth:
> Yes, modules are memory bloat hogs as you state.

Some modules are memory intensive, yes, but not all modules are created
equally. However, if modules are memory bloat hogs then so must be Perl as
most of the modules are written in Perl.

e.



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

Date: Thu, 08 Jun 2000 00:36:09 GMT
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: Perl and memory consumption
Message-Id: <ZTB%4.238886$Tn4.2162362@news1.rdc2.pa.home.com>

> Accuracy is imperative. This is why I choose counting
> blinks of my eyes over inaccurate benchmarking. However,
> guesstimation is of greater accuracy.

If accuracy is imperative, then why leave it to guesstimation?  The
Benchmark module makes it pretty easy to time code with hundredth of a
second accuracy - I don't think 'blinks of an eye' can match that


>> Loading some date module may be overkill

>Yes, and accurate averages show modules bloat
>your memory use by one-thousand percent. This
>is your personal memory use in trying to remember
>how to get a module to work right.

Most modules present a limited, consistant inferface with good
documentation.  Learning to use modules is an important skill that will save
a lot of time and effort in the long run.

> Yeah, I have pretty good reasons for not using
> modules, save for the one I like and mentioned.
> My reasons are I have no need for memory bloating
> modules, don't care for all the bugs and problems
> modules introduce, wouldn't care to pay additional
> operating expenses, not to mention modules slowing
> down my hot rod programs, which I mentioned anyhow.

Actually, most module authors work very hard to keep their code bug free and
and up-to-date

> Avoid modules. Save some time and money. You can
> spend both on whichever date you decide to graciously
> entertain for an evening, and brag about what a skilled
> programmer you are with no need for modules. Shirley she
> will understand this and be impressed right out of her
> spandex pants.

I don't think you realize the extent of what Perl can do.  Suppose you want
to tag MP3 files, or inferface with a CORBA system, or perform RC5
checksums, or interact with an Oracle database.  Do you really want to
rewrite all that code that other people have written that already does those
things?  By using modules, you can do all of them very easily.  You
recognize that LWP is a useful module for web access, I would say that most
modules tend to fall in that same useful category.  Take some time to look
at the DBI module for instance, it would be a considerable waste of time to
try to duplicate the features of that one.  Saying 'Avoid modules' is bad
advice.  When I need to solve a specific problem, the first thing I do is
check CPAN to see if someone has already solved it.  Now *that* is saving
time and money.

--Ben Kennedy




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

Date: Thu, 08 Jun 2000 00:59:06 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl and memory consumption
Message-Id: <slrn8jts3d.g9s.tjla@thislove.dyndns.org>

I was shocked! How could Joe Kline <jkline@one.net>
say such a terrible thing:
><SNIP code bloat, modules, etc....>
>
>How can someone be so against modules? Aren't they roughly analagous

The person by the name of Godzilla! is one of the resident trolls here
in clpm. Her purpose here is not to enlighten but rather to confuse
newbies by posting replies to their questions that are verbose, friendly
and (always) subtly wrong.  I believe that she does this with the intent
of driving people away from Perl when their programs (suitably altered
to her specifications) still do not work and they give up because Perl
is seemingly too hard.

When accused of this she either ignores the comments or takes one or two
sentences out of context and replies to them in an inflammatory fashion.
Her usual tactic is to accuse the person of writing code that is either
buggy, slow, or inefficient in some other way. She will not post any
corrections to the code, nor will she post any benchmarks rather simply
accusing the person (in an interesting display of meta-trollism) of
trolling. In extreme cases (ie. where the critique of her "code" has
been especially devastating and the steaming chunks lie bleeding on the
ground around her) she has been known to threaten legal action against
the person on the grounds of either sexism, racism or harrasment.

With regard to benchmarks she holds these in high disdain preferring to
measure the time it takes for one iteration of a simple piece of code to
run with a blink of her eyelids. With this method she feels she is able
to accurately determine how efficient two pieces of code are relative to
each other, forgetting (or more likely ignoring) the fact that the
startup overhead of Perl will greatly outweigh the running time of the
trivial piece of code. In her case this is probably okay since she has
been known to assert that a website attracting only 150 hits a day to be
an "extremely busy" one (or words to that effect).

Having explained all this I think the reason for her hatred of the use of
modules would be apparent. Modules make it easier to write code that is
efficient, bug free and featureful. They make it possible for the writer
of the program to concentrate on the pieces of code that are related to
the central purpose of the program without spending too much time
debugging code that is outside their area of expertise. She therefore
feels that encouraging the use of modules would harm her goal of making
the use of Perl frustrating and difficult for newbies.

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
A day without orange juice is like a day without orange juice.


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

Date: Wed, 07 Jun 2000 22:06:03 GMT
From: kpulliam@my-deja.com
Subject: Perl cgi html programmer needed for Atlanta
Message-Id: <8hmh0b$j0d$1@nnrp2.deja.com>

I need a Perl cgi html programmer for 6 month
contract in Atlanta. Please reply to:
pulliam@mail.com


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


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

Date: Wed, 07 Jun 2000 23:45:14 GMT
From: chadbour@wwa.com (James Weisberg)
Subject: Re: Perl Shortcut?
Message-Id: <e8B%4.4480$HD6.96390@iad-read.news.verio.net>

In article <MPG.13a8495c3d37e06a98ab3a@nntp.hpl.hp.com>,
Larry Rosler  <lr@hpl.hp.com> wrote:
>16:09:15 GMT, Ala Qumsieh <aqumsieh@hyperchip.com> says...
>> chadbour@wwa.com (James Weisberg) writes:
>> >    I was wondering if there was a shortcut to initializing the
>> > subkeys of a hash slice. Something like:
>> > 
>> >    @stats{@teams}{wins} = (0) x @teams;
>
>> If this is all you want then:
>> 
>> 	@stats{@teams} = ({wins => 0}) x @teams;
>> 
>> should do what you want.
>
>Note, though, that this replaces any existing hashes, which may have had 
>other keys also.  To preserve existing data other than ->{wins}, use 
>Greg Bacon's for-loop.

	Sure. The for-loop I was well aware of. Greg commented that 
for-loops "aren't so bad". I agree. I was just wondering if there
was some Perl-ese shortcut and if it was better/stronger/faster
than the for-loop. Indeed you guessed that I might want to use
this shortcut to initialize more than just the one key, and what
is written above wipes them out. So the for-loop is fine too.
	I have to say, however, that the line:

	@stats{@teams} = ({wins => 0}) x @teams;

	seems pretty doggone weird to me, and that's one of the reasons
I asked the question to begin with. There's usually some nugget of
wisdom to be gleened from looking at code like that. Constructing
the key on the rhs of the statement is something I would have never
considered. I didn't realize that was possible. Are there other more
useful reasons to do something like that?


-- 
World's Greatest Living Poster


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

Date: 8 Jun 2000 00:40:22 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Perl Shortcut?
Message-Id: <8hmq1m$vg$2@news.panix.com>

On Wed, 07 Jun 2000 23:45:14 GMT, James Weisberg <chadbour@wwa.com> wrote:
++ In article <MPG.13a8495c3d37e06a98ab3a@nntp.hpl.hp.com>,
++ Larry Rosler  <lr@hpl.hp.com> wrote:
++ >16:09:15 GMT, Ala Qumsieh <aqumsieh@hyperchip.com> says...
++ >> chadbour@wwa.com (James Weisberg) writes:
++ >> >    I was wondering if there was a shortcut to initializing the
++ >> > subkeys of a hash slice. Something like:
++ >> > 
++ >> >    @stats{@teams}{wins} = (0) x @teams;
++ >
++ >> If this is all you want then:
++ >> 
++ >> 	@stats{@teams} = ({wins => 0}) x @teams;
++ >> 
++ >> should do what you want.
++ >
++ >Note, though, that this replaces any existing hashes, which may have had 
++ >other keys also.  To preserve existing data other than ->{wins}, use 
++ >Greg Bacon's for-loop.
++ 
++ 	Sure. The for-loop I was well aware of. Greg commented that 
++ for-loops "aren't so bad". I agree. I was just wondering if there
++ was some Perl-ese shortcut and if it was better/stronger/faster
++ than the for-loop. Indeed you guessed that I might want to use
++ this shortcut to initialize more than just the one key, and what
++ is written above wipes them out. So the for-loop is fine too.
++ 	I have to say, however, that the line:
++ 
++ 	@stats{@teams} = ({wins => 0}) x @teams;
++ 
++ 	seems pretty doggone weird to me, and that's one of the reasons
++ I asked the question to begin with. There's usually some nugget of
++ wisdom to be gleened from looking at code like that. Constructing
++ the key on the rhs of the statement is something I would have never
++ considered. I didn't realize that was possible. Are there other more
++ useful reasons to do something like that?

There are very useful reasons *NOT* to do something like this. All
references will be shared. Consider:

    #!/opt/perl/bin/perl -w

    use strict;

    my @teams = qw /red blue green yellow/;
    my %stats;
    @stats {@teams} = ({wins => 0}) x @teams;

    $stats {red} {wins} ++;   # Only red wins?

    foreach my $team (@teams) {
        print "$team has won $stats{$team}{wins} times\n";
    }
    __END__
    red has won 1 times
    blue has won 1 times
    green has won 1 times
    yellow has won 1 times


Not really what you want, is it?


Abigail


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

Date: Wed, 07 Jun 2000 22:09:11 GMT
From: jonadab@bright.net (Jonadab the Unsightly One)
Subject: Re: Perl unusable as a programming language
Message-Id: <393bb71c.13483526@news.bright.net>

Russell Bornschlegel <kaleja@estarcion.com> wrote:

> So, uh, the current versions of Active Perl aren't irredeemably tainted, are 
> they? I'd hate to have to burn all three computers I've installed it on...

I'm using a _relatively_ recent ActivePerl, and it doesn't 
*appear* to have any silly dialogue boxes or other nonsense.  
I run it from the command line.  It seems okay.  It doesn't 
seem reminiscent of Visual Basic in any way.  So, um, get 
it while you can?

- jonadab


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

Date: Wed, 7 Jun 2000 09:55:54 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl's evaluation order for a logical expression
Message-Id: <slrn8jsojq.p8.tadmc@maxim.metronet.com>

On Wed, 07 Jun 2000 04:44:20 GMT, T. Alex Beamish <talexb@tabsoft.on.ca> wrote:
>I'm having fits with a script that has code like
>
>  if ( ( $Col > 1 ) &&
>       ( defined ( $Table[ $Col - 1 ][ $Row ] ) ) &&
>       ( $Table[ $Col - 1 ][ $Row ] eq $TableHash->{ 'stmt_date' } ) )
>
>Apache is complaining that there is the "Use of uninitialized value"
>somewhere in the line. I'm damned if I can find it .. 


One of these 3 is undef:

   $Col
   $Row
   $TableHash->{ 'stmt_date' }


>however it may
>depend on the order that perl evaluates the logical expression.


So go read about && in perlop.pod and find out what order
it evaluates them:

   "if the left operand is false, the right operand is not even evaluated"

so the left operand must be evaluated before the right one.

i.e. the order is from left to right


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


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

Date: Wed, 7 Jun 2000 14:50:36 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: perldoc & perlop man page?
Message-Id: <8hmg23$90v$1@brokaw.wa.com>


Helza <helza@planet.nl> wrote in message
news:8hmfj3$8qphj$1@reader2.wxs.nl...
> Hi,
>
> I have the problem that i'm still learing to write perl, and directly
> started out with a pretty difficult project for myself.
>
> Now the problem is that often if i get stuck somewhere and ask it i get
> answers like look it up with perldoc -f commandstuff or look at the perlop
> man page or something. However I only have ftp access to my website :( and
> running a windows98 computer.
>
> except downloading activeperl which i don't understand how to use i have
no
> idea how i could get that perldoc info or perlop man stuff.

On Windows systems you can go to Start->Programs->ActivePerl->Online
Documentation

You can find all the Perl documentation there.

Lauren





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

Date: Wed, 7 Jun 2000 12:55:30 +0200
From: "Hrvoje F." <hfucek@zg.hinet.hr>
Subject: PLEASE HELP - PLEASE READ
Message-Id: <8hmhj4$f4s$1@as102.tel.hr>

I would apreciate if anyone could send me a free script for personal adds
which would include ability to automatically delete, add, view and search
the adds.

both nt or unix server (we preffer nt)

Thank you very much





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

Date: Wed, 07 Jun 2000 18:45:14 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: PLEASE HELP - PLEASE READ
Message-Id: <393ED07A.B80BD7F6@attglobal.net>

"Hrvoje F." wrote:
> 
> I would apreciate if anyone could send me a free script for personal adds
> which would include ability to automatically delete, add, view and search
> the adds.

PLEASE USE A MEANIGFULL SUBJECT, PLEASE DON'T BEG.

> 
> both nt or unix server (we preffer nt)

I prefer being paid for my work.  Silly me.


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

Date: 7 Jun 2000 23:05:46 GMT
From: H. Camphausen <h.camp@scm.de>
Subject: RFC: Perl module ESplit.pm now available
Message-Id: <8hmkga$dan$2@surz18.HRZ.Uni-Marburg.DE>

Hi,

I made a new Perl module available on the web:
	
	ESplit.pm 
	http://www.creagen.de/downloads/ESplit100.zip
	
Documentaion (not complete yet) ia available at:

	http://www.creagen.de/mo_docs/e_split.htm

ESplit.pm provides one function, e_split(), to split (sic!) scalar values 
(AKA strings) at arbitrary characters/strings (may be given as regex).
Usefull to deal with CSV data.

- Delimiters contained in quoted strings will be ignored, as well as \- 
  escaped delimiters.
- Delimiters given in () will be returned as n + 1. elements in the
  resulting array (like split()).
- One can tell e_split() to return only the first n elements - or the
  last n elements.
	  
e_split is 2-5 times faster than Text::ParseWords::parse_line.
e_split deals with quoted strings (fields) in a more reasonable way
  (well, IMHO :-)) than parse_line.
e_split deals correctly with mixed qoutes (e.g. double quotes at start of
  a field, a single one at the end).
	
Any comments and suggestions are highly appreciated.


Cheers, Hartmut

-- 
CREAGEN Computerkram     Fon: 06424/923826
Hartmut Camphausen       Fax: 06424/923827
Kirchstraße 8            E-Mail: h.camp@creagen.de
35043 Marburg            WWW: http://www.creagen.de


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

Date: Wed, 07 Jun 2000 23:17:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: string help needed
Message-Id: <sjtm0ebv2t5177@corp.supernews.com>

D.W. (dpalmeNOSPAM@unitedtraffic.com) wrote:
: I have four variables such as:
: 
: $lat1 = 41.837050N;
: $lon1 = 87.684965W;
: $lat2 = 42.270300N;
: $lon = 89.063149W;
: 
: I'm wanting to put these values in another variable in the following manner
: 
: $string = ( [quote here] $lat1 [space here] $lon1[quote here] [space here]
: [quote here] $lat2 [space here] $lon2 [quote here] );

  $string = qq("$lat1 $lon1" "$lat2 $lon2");

You could also escape the quotes inside a 'normal' double-quoted string,
but using qq is a lot prettier. 

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "You live in Los Angeles, and you are going to Reseda; we are
   |   all in some way or another going to Reseda someday, to die."
               - Soul Coughing


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

Date: Wed, 7 Jun 2000 18:21:37 +0100
From: "Dmitry Podborits" <dmitryp@attglobal.net>
Subject: Re: Text Sorting Question
Message-Id: <393ecac2$0$19628@wodc7nh7.news.uu.net>

Assuming
my $COLUMN_NUMBER = 2;  # Change to the column number by which you want to
sort:

If your file is small enough for you not to worry about performance
implications of doing more splits than you need to, you can do the whole
thing in one line:

print sort { ( split /;/, $a )[ $COLUMN_NUMBER ] cmp ( split /;/,
b )[ $COLUMN_NUMBER ] } <>;
(You may want to replace cmp with <=> if the data you are sorting is
numeric, etc.

Alternatively, you can speed up the program a lot by using an intermediate
hash:

my %h = map { $_, ( split /;/ )[ $COLUMN_NUMBER ] } =  my @a = <>;
print sort { $h{ $a } cmp $h{ $b } } @a;

Best regards,
Dmitry

P.S. If your file is small enough for you not to worry about performance
implications, you can probably go straight w

Jim Ray <jim.ray@west.boeing.com> wrote in message
news:FvsruC.7t9@news.boeing.com...
> I have question I am hoping someone can answer. I have a text file that
has
> 7 fields delimited by ";".  I want to be able to sort on either field 2 or
> 3.  I thought I had a routine to do this, but it seems I was wrong.
>
> Does anyone know how this can be done?  I am running Perl 5.x on a Unix
and
> NT system.
>
> Example:
>             Sort or Sort
> Field1;Field2;Field3;Field4;Field5;Field6;Field7;
> Field1;Field2;Field3;Field4;Field5;Field6;Field7;
> Field1;Field2;Field3;Field4;Field5;Field6;Field7;
> Field1;Field2;Field3;Field4;Field5;Field6;Field7;
>
> Thank you for any help you can give me.
>
> Jim
> jaray@relaypoint.net
>
>




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

Date: Wed, 7 Jun 2000 17:27:23 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Text Sorting Question
Message-Id: <MPG.13a8884bceeb04f398ab41@nntp.hpl.hp.com>

In article <s8ftjsgu8nns8jppavechqke610l9r8th2@4ax.com> on Wed, 07 Jun 
2000 23:58:27 +0200, Abe Timmerman <abe@ztreet.demon.nl> says...

 ...

> If sorting this thing is the main objective, use Schwartzian-Transform
> or Rosler/Guttman-Transform.

That's Guttman-Rosler Transform, as in GReaT!

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


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

Date: Thu, 08 Jun 2000 00:04:43 GMT
From: kferron@iwon.com (Kevin Ferron)
Subject: unimplented flock() running ActivePerl win98
Message-Id: <vqB%4.102174$h01.807599@news1.rdc1.mi.home.com>

[Wed Jun 07 19:53:54 2000] [error] [client 127.0.0.1] Premature end of 
script headers: c:/inetpub/keen/cgi-bin/bizcard.pl
[Wed Jun 07 19:53:54 2000] [error] [client 127.0.0.1] flock() unimplemented 
on this platform at c:/inetpub/keen/cgi-bin/bizcard.pl line 111.



I keep getting this error in my log files when I attempt to run this perl 
script. I'm inexperienced with Perl on win32 systems. I am trying to 
isolate the problem... my question is: Does this appear to be an 
uninstalled module issue, or an error in the code?  Any points in the right 
direction would be greatly appreciated.

    	    	    	    	    	    	    	    	    	    	KFerron


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

Date: Wed, 7 Jun 2000 17:12:04 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: unimplented flock() running ActivePerl win98
Message-Id: <8hmobj$e6s$1@brokaw.wa.com>


Kevin Ferron <kferron@iwon.com> wrote in message
news:vqB%4.102174$h01.807599@news1.rdc1.mi.home.com...
> [Wed Jun 07 19:53:54 2000] [error] [client 127.0.0.1] Premature end of
> script headers: c:/inetpub/keen/cgi-bin/bizcard.pl
> [Wed Jun 07 19:53:54 2000] [error] [client 127.0.0.1] flock()
unimplemented
> on this platform at c:/inetpub/keen/cgi-bin/bizcard.pl line 111.
>
>
>
> I keep getting this error in my log files when I attempt to run this perl
> script. I'm inexperienced with Perl on win32 systems. I am trying to
> isolate the problem... my question is: Does this appear to be an
> uninstalled module issue, or an error in the code?  Any points in the
right
> direction would be greatly appreciated.
>

Check out the perlwin32faq5 - Implementation Quirks.

Start->Programs->ActivePerl->Online Documentation

then scroll down the left pane to Quirks.

Lauren





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

Date: Wed, 07 Jun 2000 23:09:42 GMT
From: atramos_us@my-deja.com
Subject: web-based ppm broken?
Message-Id: <8hmkn9$oq4$1@nnrp1.deja.com>

PPM used to work fine for several months. Now it's broken,
even after a full reinstall of Perl! The install-over-the-web
functionality consistently produces XML errors. For example:


         C:\TEMP>ppm search DBI

         no element found at line 1819, column 31, byte 99329 at
           C:/Perl/site/lib/SOAP/Parser.pm line 73

The above was produced in a fresh install of Perl5.6 with ppmfix,
but similar problems occur in Perl5.005. (both binary Perls from
ActiveState)

What's going on?

thanks,
Alex Ramos
(please reply to the newsgroup; I don't read e-mail very often)


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


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

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


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