[16830] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4242 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 6 21:05:31 2000

Date: Wed, 6 Sep 2000 18:05:13 -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: <968288713-v9-i4242@ruby.oce.orst.edu>
Content-Type: text

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

Today's topics:
    Re: A Challenge <got1toomany@trojans.com>
    Re: A Challenge <brian+usenet@smithrenaud.com>
    Re: Beating the perlcc dead horse again... (Martien Verbruggen)
    Re: Beginner question about extracting data from file <matt.stoker@motorola.com>
        cannot open include file 'sys/types.h' <john@eagleinfosystems.com>
        Export data to an Excel spreadsheet? <jedgar@mail.arc.nasa.gov>
    Re: Export data to an Excel spreadsheet? <stephenk@cc.gatech.edu>
    Re: Generate Graphics by Perl <srmalloy@home.com>
    Re: Generate Graphics by Perl <brian+usenet@smithrenaud.com>
    Re: golf: remove .txt from filenames <lr@hpl.hp.com>
    Re: golf: remove .txt from filenames <anmcguire@ce.mediaone.net>
    Re: golf: remove .txt from filenames <anmcguire@ce.mediaone.net>
    Re: Good companion book to Programming Perl? <gdonovanNOgdSPAM@jeffco.k12.co.us.invalid>
        Grabbing a WEB PAGE <tom@webign.co.uk>
    Re: Grabbing a WEB PAGE <tom@webign.co.uk>
    Re: Help needed - regexp (Mark-Jason Dominus)
    Re: Help needed - regexp <lr@hpl.hp.com>
    Re: Help needed - regexp <ren.maddox@tivoli.com>
    Re: How to find new page character <np> using Perl <ren.maddox@tivoli.com>
    Re: HTML::parse bug (Randal L. Schwartz)
        INTERNATIONAL PERL TELECOMMUTING TelecommutePERL@GlobalWorkInt.com
    Re: INTERNATIONAL PERL TELECOMMUTING <brian+usenet@smithrenaud.com>
    Re: memory useage issues <tim@ipac.caltech.edu>
        missing MSPDB60.dll <john@eagleinfosystems.com>
    Re: missing MSPDB60.dll <john@eagleinfosystems.com>
        Need syntax to specify address to sendmail to fwd all M <gdonovanNOgdSPAM@jeffco.k12.co.us.invalid>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 06 Sep 2000 22:20:43 GMT
From: James Bond <got1toomany@trojans.com>
Subject: Re: A Challenge
Message-Id: <cpgdrs0j5u3v9pa4jttfovb54j2tuvi0ge@4ax.com>

On 3 Sep 2000 19:44:46 -0500, logan@cs.utexas.edu (Logan Shaw) wrote:

Sorry, I guesss I missunderstood the purpose of this group. I THOUGHT
it was a place where an inexperienced person who is TRYING to learn
Perl might get some USEFUL advise from those who are more experienced.
I did not realize  that you were all here to SELL your services as
expert developers. I thought people here actually enjoyed what they
did, and pehaps enjoyed sharing thier knowlegde. 

Oh, and BTW, to me, this was a challenge. As well, no need to insult
the writer of this script. It does exactly what it claims to, and
quite effectively.

As I realize the kind of responce this is likely to generate, I won't
bother checking back in.


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

Date: Wed, 06 Sep 2000 20:45:13 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: A Challenge
Message-Id: <brian+usenet-E4F109.20451306092000@news.panix.com>

In article <cpgdrs0j5u3v9pa4jttfovb54j2tuvi0ge@4ax.com>, James Bond 
<got1toomany@trojans.com> wrote:

> On 3 Sep 2000 19:44:46 -0500, logan@cs.utexas.edu (Logan Shaw) wrote:

> Sorry, I guesss I missunderstood the purpose of this group. I THOUGHT
> it was a place where an inexperienced person who is TRYING to learn
> Perl might get some USEFUL advise from those who are more experienced.

you did get useful advice.  you just didn't get the advice that
you wanted.

> I did not realize  that you were all here to SELL your services as
> expert developers. I thought people here actually enjoyed what they
> did, and pehaps enjoyed sharing thier knowlegde. 

there's a difference between offering help and demanding it.
a lot of people enjoy what they do.  that doesn't mean they
enjoy doing what you do.

-- 
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Wed, 06 Sep 2000 23:31:59 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Beating the perlcc dead horse again...
Message-Id: <slrn8rdkv0.2cp.mgjv@verbruggen.comdyn.com.au>

On Wed, 06 Sep 2000 15:45:50 GMT,
	vi_2000@hotmail.com <vi_2000@hotmail.com> wrote:
> 
> Perl must suck since the three posts to my question offer nothing of
> value except criticism which in itself is totally worthless when I am
> trying to build a useful program!

If you use the same logic in your programming, then I doubt that
anything will ever work.

> So Long Perl humpers.  I'm going back to C++ where I can get real work
> done!

I personally think you'll be much happier there. The culture seems to
suit your temperament better.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd.   | bundled with your Microsoft product.
NSW, Australia                  | 


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

Date: Wed, 06 Sep 2000 14:46:53 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: Beginner question about extracting data from file
Message-Id: <39B6BB4D.4E708F65@motorola.com>

Geoff Soper wrote:
> 
> If I have a simple file in the format:
> 
> user, password, alias
> rod, abc, "rod@hotmail.com"
> jane, def, "jane@excite.com"
> freddy, ghi, "freddy@bigfoot.com"
> 
> How can I get them into the format of
> 
> $fields(1)="user"
> $fields(2)="password"
> $fields(3)="alias"
> 
> %user="rod,jane,freddy"
> 
> $password(rod)="abc"
> $password(jane)="def"
> $alias(freddy)="freddy"
> 
> I hope this makes sense and would be most grateful if somebody could
> point me in the right direction.
> 
> Many thanks

A good description of implementing complex data structures can be found
in chapter 2 of "Advanced Perl Programming" by Sriram Srinivasan (from
O'Reilly). The book describes using hashes of hashes, hashes of arrays
and arrays of arrays to set up a data structure like you seem to want.
There is some discussion about the trade offs of various structures. 

If you don't want to buy the book, some information can be found at:

http://www.perl.com/pub/v/documentation

under the heading of Data Structures.




-- 
/------------------------------------------------------------------\
| Matt Stoker                |     email: matt.stoker@motorola.com |
| Unit Process Modeling      | Mail Drop: M360                     |
| DigitalDNA(TM) Laboratories|     Phone: (480)655-3301            |
| Motorola, SPS              |       Fax: (480)655-5013            |
| 2200 W Broadway Road       |     Pager: (888)699-8803            |
| Mesa, AZ 85202             |                                     |
\------------------------------------------------------------------/


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

Date: Wed, 6 Sep 2000 20:53:01 -0400
From: "John Menke" <john@eagleinfosystems.com>
Subject: cannot open include file 'sys/types.h'
Message-Id: <39b6e6f0$1_2@news.eclipse.net>

Where can I get this file?


I am getting the following error:

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

Base64.c
F:\Perl\lib\CORE\perl.h(426) : fatal error C1083: Cannot open include file:
'sys
/types.h': No such file or directory
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~6\VC98\BIN\cl.exe' : return
code
'0x2'
Stop.
  C:\PROGRA~1\MICROS~6\VC98\BIN\nmake.exe  -- NOT OK
Running make test
  Oops, make had returned bad status
Running make install
  Oops, make had returned bad status

Bad command or file name
cpan>





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

Date: Wed, 6 Sep 2000 16:59:47 -0700
From: "Joe Edgar" <jedgar@mail.arc.nasa.gov>
Subject: Export data to an Excel spreadsheet?
Message-Id: <8p6lov$80$1@sun500.nas.nasa.gov>


I've got a program that displays a database in HTML.   My new "assignment"
is to let a user select certain fields of the database and then export those
fields to an excel spreadsheet.
I've been trying to create a comma-separated-value (of the fields) with a
".csv" extension, but that doesn't seem to work.
I need the program to open an Excel spreadsheet and import the data once the
user clicks the submit button.
Does any one have experience with this?

Thanks in advance..

--
----------------------------------
Joseph Edgar
Web Development Team
Dir: (650) 604-0047
NASA Ames Research Center
Moffett Field, CA 94035





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

Date: Wed, 06 Sep 2000 21:00:30 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: Export data to an Excel spreadsheet?
Message-Id: <39B6E8AE.34EC504@cc.gatech.edu>

Joe Edgar wrote:

> I've got a program that displays a database in HTML.   My new "assignment"
> is to let a user select certain fields of the database and then export those
> fields to an excel spreadsheet.
> I've been trying to create a comma-separated-value (of the fields) with a
> ".csv" extension, but that doesn't seem to work.
> I need the program to open an Excel spreadsheet and import the data once the
> user clicks the submit button.
> Does any one have experience with this?
>
> Thanks in advance..
>
> --
> ----------------------------------
> Joseph Edgar
> Web Development Team
> Dir: (650) 604-0047
> NASA Ames Research Center
> Moffett Field, CA 94035

perldoc Win32::OLE

--
Stephen Kloder               |   "I say what it occurs to me to say.
stephenk@cc.gatech.edu       |      More I cannot say."
Phone 404-874-6584           |   -- The Man in the Shack
ICQ #65153895                |            be :- think.




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

Date: Wed, 06 Sep 2000 23:55:18 GMT
From: Sean Malloy <srmalloy@home.com>
Subject: Re: Generate Graphics by Perl
Message-Id: <mlldrs8li8to3tmheq45ovfrb7oqp3jvji@4ax.com>

David Hiskiyahu <David.Hiskiyahu@alcatel.be> wrote:

>I have a Perl script, called via a CGI form.
>
>The script reads user input from the CGI parameter list, scans 
>some data on the server and generates a table as a result, a 
>rather classical use of Perl with CGI.
>
>In addition to the table, I would like to present a bar-chart.
>
>Does someone have an example of Perl doing such graphics?
>Lines, bars, text - that's what I need to have in he chart.

Bar charts are easy -- cheat.

1) Create as many NxN GIF images as you have different-colored bars
   (if they're solid color, you can make them 1x1).

2) Have your Perl script manipulate its data and produce a table. For
   each bar in the chart -- either a row or column in the table -- you
   put an <IMG> tag with the bar image resized to make it the right 
   size for that bar. For example, if you wanted percentages as
   horizontal bars ten pixels high, and the space for the bars gave
   you 400 pixels, then you would have your Perl script compute the
   percentage, multiply it by four, and use that as the WIDTH 
   attribute of the <IMG> tag.

For an example of this kind of bar-graph image manipulation, go to 

    http://www-nmcsd.med.navy.mil/stats/index.html

The access statistics HTML file for the current month is generated
nightly by a Perl script that reads the access log of the webserver.
It's a minor modification to the wwwstat Perl script (available on the
Net); I hacked it to produce bar graphs as well as numbers.

I have a more complicated example that is interactive -- the user
specifies what data they want through three levels of forms, and then
the Perl script extracts the data from an Access database and draws
bargraphs -- but that program is 31 pages long and is on our intranet
behind a firewall. I can send you the code, however, if you're
interested in seeing it.


-- 
Sean R. Malloy               | American Non Sequitur
    Naval Medical Center     |       Society
    San Diego, CA 92134-5000 |
srmalloy@home.net            | "We may not make sense,
srmalloy@nmcsd.med.navy.mil  |  but we do like pizza"
FORMAL NOTICE: unsolicited commercial email will be read
at a charge of $500 per item. Receipt of such email shall
be considered to constitute acceptance of contract, and 
will be billed immediately.


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

Date: Wed, 06 Sep 2000 20:47:09 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: Generate Graphics by Perl
Message-Id: <brian+usenet-D26B34.20470906092000@news.panix.com>

In article <mlldrs8li8to3tmheq45ovfrb7oqp3jvji@4ax.com>, 
srmalloy@home.com wrote:

> David Hiskiyahu <David.Hiskiyahu@alcatel.be> wrote:

> >Does someone have an example of Perl doing such graphics?
> >Lines, bars, text - that's what I need to have in he chart.

> Bar charts are easy -- cheat.

> 1) Create as many NxN GIF images as you have different-colored bars
>    (if they're solid color, you can make them 1x1).

in this case, i think your cheating advice takes more work than
using GD::Graph.

-- 
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Wed, 6 Sep 2000 15:37:29 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: golf: remove .txt from filenames
Message-Id: <MPG.14206703188af60998ad31@nntp.hpl.hp.com>

In article <39B6B137.8E8A5E7B@motorola.com> on Wed, 06 Sep 2000 14:03:51 
-0700, Matthew Stoker <matt.stoker@motorola.com> says...
> Matthew Stoker wrote:
> > 
> > perl -e'/(.+)\.txt$/&&rename$_,$1for<*>'  - Larry Rosler (syntax error)

Nonsense.  Of course it was tested (on both Unix and Windows NT -- with 
double-quotes instead of single-quotes) and of course it works fine.

> > perl -e'/\.txt$/&&rename$_,$`for<*>'      - Yanick Champoux (syntax
> > error)

That should be fine also.  In fact, I posted it in Abigail's subthread, 
after having been reminded of $`, which I never use in real code.

> > perl -e'map{?(.*).txt$?;rename$&,$1}<*>'  - Andrew N. McGuire(only
> > changes 1st file)

That's because of the idiosyncratic use of '?' to delimit the regex.

> > ls|perl -ne'/\.txt$/&&rename$_,$`'        - Abigail (does nothing)
> 
> > ^^^^^^ These don't seem to work on my machine. (Maybe I'm doing something wrong)

Clearly.  (In addition to not wrapping your lines correctly. :-)

> Uri Guttman's correction to Abigail's entry does the trick:
> 
>   ls|perl -lne'/\.txt$/&&rename$_,$`'
> 
> is the current champion!

But wouldn't work where there was no 'ls' command, so flunks, IMO.

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


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

Date: Wed, 06 Sep 2000 18:56:40 -0500
From: "Andrew N. McGuire" <anmcguire@ce.mediaone.net>
Subject: Re: golf: remove .txt from filenames
Message-Id: <39B6D9B8.BE39FDC0@ce.mediaone.net>

On Wed, 6 Sep 2000, Matthew Stoker quoth:

~~ Date: Wed, 06 Sep 2000 14:03:51 -0700
~~ From: Matthew Stoker <matt.stoker@motorola.com>
~~ Newsgroups: comp.lang.perl.misc
~~ Subject: Re: golf: remove .txt from filenames
~~ 
~~ Matthew Stoker wrote:
~~ > 
~~ > perl -e'/(.+)\.txt$/&&rename$_,$1for<*>'  - Larry Rosler (syntax
error)
~~ > perl -e'/\.txt$/&&rename$_,$`for<*>'      - Yanick Champoux (syntax
~~ > error)
~~ > perl -e'map{?(.*).txt$?;rename$&,$1}<*>'  - Andrew N. McGuire(only
~~ > changes 1st file)
~~ > ls|perl -ne'/\.txt$/&&rename$_,$`'        - Abigail (does nothing)
~~ 
~~ > ^^^^^^ These don't seem to work on my machine. (Maybe I'm doing
something wrong)
~~ 
~~ Uri Guttman's correction to Abigail's entry does the trick:
~~ 
~~   ls|perl -lne'/\.txt$/&&rename$_,$`'
~~ 
~~ is the current champion!

Combining Abigail's and mine:

perl -e'map{/\.txt$/;rename$_,$`}<*>'

or even

perl<CR>
map{/\.txt$/;rename$_,$`}<*><CR>
C-d

which actually saves 3 strokes on that if my count is correct.
(I dont know if that is allowed in golf!!!)

which does all files (I dont know why I used ?? before, trying to be
cute I guess).  Uri's is still the champion, but mine does not use
unix commands.  One note, Uri's modification to Abigails post works
in Bourne shell variants, but not C shell (tcsh at least). So you
may want to qualify that as:

sh -c ls|perl -lne'/\.txt$/&&rename$_,$`'

My default shell is tcsh:

[anm@hawk ~/test] ls | perl -nle'/\.txt$/&&rename$_,$`'         [pts/2]
[anm@hawk ~/test] ls                                            [pts/2]
test.txt  test2     test3     
[anm@hawk ~/test] sh -c ls | perl -nle'/\.txt$/&&rename$_,$`'   [pts/2]
[anm@hawk ~/test] ls                                            [pts/2]
test   test2  test3  

Best Regards,

anm
-- 
Andrew N. McGuire
anmcguire@ce.mediaone.net
perl -le'print map?"(.*)"?&&($_=$1)&&s](\w+)]\u$1]g&&$_=>`perldoc -qj`'


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

Date: Wed, 6 Sep 2000 19:00:41 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: golf: remove .txt from filenames
Message-Id: <Pine.LNX.4.21.0009061859140.4346-100000@hawk.ce.mediaone.net>

[ sorry if this shows up more than once ]

On Wed, 6 Sep 2000, Matthew Stoker quoth:

~~ Date: Wed, 06 Sep 2000 14:03:51 -0700
~~ From: Matthew Stoker <matt.stoker@motorola.com>
~~ Newsgroups: comp.lang.perl.misc
~~ Subject: Re: golf: remove .txt from filenames
~~ 
~~ Matthew Stoker wrote:
~~ > 
~~ > perl -e'/(.+)\.txt$/&&rename$_,$1for<*>'  - Larry Rosler (syntax error)
~~ > perl -e'/\.txt$/&&rename$_,$`for<*>'      - Yanick Champoux (syntax
~~ > error)
~~ > perl -e'map{?(.*).txt$?;rename$&,$1}<*>'  - Andrew N. McGuire(only
~~ > changes 1st file)
~~ > ls|perl -ne'/\.txt$/&&rename$_,$`'        - Abigail (does nothing)
~~ 
~~ > ^^^^^^ These don't seem to work on my machine. (Maybe I'm doing something wrong)
~~ 
~~ Uri Guttman's correction to Abigail's entry does the trick:
~~ 
~~   ls|perl -lne'/\.txt$/&&rename$_,$`'

[ snip ]

Combining Abigail's and mine:

perl -e'map{/\.txt$/;rename$_,$`}<*>'

or even

perl<CR>
map{/\.txt$/;rename$_,$`}<*><CR>
C-d

which actually saves 3 strokes on that if my count is correct.
(I dont know if that is allowed in golf!!!)

which does all files (I dont know why I used ?? before, trying to be
cute I guess).  Uri's is still the champion, but mine does not use
unix commands.  One note, Uri's modification to Abigails post works
in Bourne shell variants, but not C shell (tcsh at least). So you
may want to qualify that as:

sh -c ls|perl -lne'/\.txt$/&&rename$_,$`'

My default shell is tcsh:

[anm@hawk ~/test] ls | perl -nle'/\.txt$/&&rename$_,$`'         [pts/2]
[anm@hawk ~/test] ls                                            [pts/2]
test.txt  test2     test3
[anm@hawk ~/test] sh -c ls | perl -nle'/\.txt$/&&rename$_,$`'   [pts/2]
[anm@hawk ~/test] ls                                            [pts/2]
test   test2  test3

Best Regards,

anm
-- 
Andrew N. McGuire
anmcguire@ce.mediaone.net
perl -le'print map?"(.*)"?&&($_=$1)&&s](\w+)]\u$1]g&&$_=>`perldoc -qj`'



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

Date: Wed, 06 Sep 2000 16:39:54 -0700
From: sysnovice <gdonovanNOgdSPAM@jeffco.k12.co.us.invalid>
Subject: Re: Good companion book to Programming Perl?
Message-Id: <17599f0b.90ce3445@usw-ex0109-069.remarq.com>

I am new to perl and have never learned a programming
language before. I started out trying to use the dummy book,
programming perl, and learning perl but I guess I'm dumber
than I thought. I was not getting it at all. I found a book
called Beggining Perl by Simon Cozens from Wrox Press. This
book was written for friends of Cozens that had never been
exposed to programming. He starts at the level of a minivan
driver and goes up from there. Its just what I needed
because even the dummy book is not condesending enough for a
novice Sysad like me.


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful


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

Date: Thu, 7 Sep 2000 01:22:58 +0100
From: "Tom Fotheringham" <tom@webign.co.uk>
Subject: Grabbing a WEB PAGE
Message-Id: <8p6n4s$96q$1@uranium.btinternet.com>

I read somewhere that I could get the contents of a webpage (specified by
URL) into a an array (in HTML format or text value (I'm not sure)). Can
anyone verify this, and perhaps hint as to how its done.




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

Date: Thu, 7 Sep 2000 01:43:17 +0100
From: "Tom Fotheringham" <tom@webign.co.uk>
Subject: Re: Grabbing a WEB PAGE
Message-Id: <8p6obf$pjb$1@plutonium.btinternet.com>

Soryy didn't check rest of posts.  Apologies Tom Fotheringham




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

Date: Wed, 06 Sep 2000 22:23:58 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Help needed - regexp
Message-Id: <39b6c3fe.1380$21a@news.op.net>

In article <MPG.1420456f609eb7e598ad2c@nntp.hpl.hp.com>,
Larry Rosler  <lr@hpl.hp.com> wrote:
>You are oh, so close.  All you need is to use a non-greedy match.  See 
>perlre.

The non-greedy match

        $ss =~ s/<(.*?)>/{$1}/g;

is about 60% slower than the negated character class match:

        $ss =~ s/<([^>]*)>/{$1}/g;

for this particular case.



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

Date: Wed, 6 Sep 2000 15:50:10 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Help needed - regexp
Message-Id: <MPG.142069fc256036a698ad32@nntp.hpl.hp.com>

In article <39b6c3fe.1380$21a@news.op.net> on Wed, 06 Sep 2000 22:23:58 
GMT, Mark-Jason Dominus <mjd@plover.com> says...
> In article <MPG.1420456f609eb7e598ad2c@nntp.hpl.hp.com>,
> Larry Rosler  <lr@hpl.hp.com> wrote:
> >You are oh, so close.  All you need is to use a non-greedy match.  See 
> >perlre.
> 
> The non-greedy match
> 
>         $ss =~ s/<(.*?)>/{$1}/g;
> 
> is about 60% slower than the negated character class match:
> 
>         $ss =~ s/<([^>]*)>/{$1}/g;
> 
> for this particular case.

I don't doubt what you say (though a posted benchmark would spare others 
the trouble of confirming it the long way).  What I don't see is how the 
performance of the two regexes should differ.  (I wrote the non-greedy 
[abstemious?] match because it changed the OP's regex minimally, was 
more didactic, and used fewer keystrokes; any one of those reasons would 
have sufficed. :-)

Unlike '.*', '.*?' shouldn't eat up everything then backtrack.  It 
should stop after each character to see if the remainder matches the 
rest of the regex, namely '>'.  This should be exactly the same as 
'[^>]*', which should stop at the first non-'>' character.

If their performances differ as much as you say, there may be an 
implementation deficiency (aka optimization opportunity).

Call for Ilya!

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


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

Date: 06 Sep 2000 18:19:12 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Help needed - regexp
Message-Id: <m3em2x2jnz.fsf@dhcp11-177.support.tivoli.com>

Larry Rosler <lr@hpl.hp.com> writes:

> In article <39b6c3fe.1380$21a@news.op.net> on Wed, 06 Sep 2000 22:23:58 
> GMT, Mark-Jason Dominus <mjd@plover.com> says...
> > In article <MPG.1420456f609eb7e598ad2c@nntp.hpl.hp.com>,
> > Larry Rosler  <lr@hpl.hp.com> wrote:
> > >You are oh, so close.  All you need is to use a non-greedy match.  See 
> > >perlre.
> > 
> > The non-greedy match
> > 
> >         $ss =~ s/<(.*?)>/{$1}/g;
> > 
> > is about 60% slower than the negated character class match:
> > 
> >         $ss =~ s/<([^>]*)>/{$1}/g;
> > 
> > for this particular case.
> 
> I don't doubt what you say (though a posted benchmark would spare others 
> the trouble of confirming it the long way).  What I don't see is how the 
> performance of the two regexes should differ.  (I wrote the non-greedy 
> [abstemious?] match because it changed the OP's regex minimally, was 
> more didactic, and used fewer keystrokes; any one of those reasons would 
> have sufficed. :-)
> 
> Unlike '.*', '.*?' shouldn't eat up everything then backtrack.  It 
> should stop after each character to see if the remainder matches the 
> rest of the regex, namely '>'.  This should be exactly the same as 
> '[^>]*', which should stop at the first non-'>' character.

Well, one difference would be that the negated character class never
needs to backtrack at all.

> If their performances differ as much as you say, there may be an 
> implementation deficiency (aka optimization opportunity).

That may be true, but it is also worth noting that these two REs are
not equivalent (well, in this context they are, but not in all
contexts).  If nothing else, this prevents the simple optimization of
converting the non-greedy [frugal?] match directly to the negated
character class match.

I would expect that the character class matching is simply more
optimized than the backtracking.  But it certainly seems worth
exploring.

> Call for Ilya!

-- 
Ren Maddox
ren@tivoli.com


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

Date: 06 Sep 2000 18:06:45 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: How to find new page character <np> using Perl
Message-Id: <m3hf7t2k8q.fsf@dhcp11-177.support.tivoli.com>

Art Haas <arthur.haas@westgeo.com> writes:

> $ cat junk.pl
> #!/usr/local/bin/perl
> use strict;
> 
> my $file = '/your/file/here';
> open(FILE,"<$file") || die "Can't open `$file'! $!\n";
> while(<FILE>) {
> 	if (m!\<np\>!) {

You don't need to escape angle brackets here...

> 		s/\<np\>//;

 ...or here.

> 	}

In fact, you don't need that if statement at all.  The substitution
alone will suffice:

        s/<np>//g;

> 	print;
> }
> $ perl junk.pl > junk.out
> 
> `junk.out' should have no `<np>' strings in it.

Moreover, you can just use:

perl -i.bak -pe 's/<np>//g' /your/file/here

-- 
Ren Maddox
ren@tivoli.com


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

Date: 06 Sep 2000 15:18:37 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: HTML::parse bug
Message-Id: <m1aedlkvuq.fsf@halfdome.holdit.com>

>>>>> "Tim" == Tim Cockle <T.Cockle@staffs.ac.uk> writes:

Tim> I have found a bug somwwhere in HTML::parse. I have written a simple
Tim> server wich works fine. However if I convert it into a forking server it
Tim> crashes out.

And further down in this thread, you post code that shows something in
a SIG handler other than $SIG{WHATEVER} = 'IGNORE'.

You *will* experience crashes then.  Get used to it.  Signals
are not reliable, and this is the unreliablity. :)

The bug is not in HTML::Parse.  Nothing to see here.  Move along. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 6 Sep 2000 18:02:08 -0500
From: TelecommutePERL@GlobalWorkInt.com
Subject: INTERNATIONAL PERL TELECOMMUTING
Message-Id: <39b6ccf0$3_2@goliath.newsfeeds.com>

         *** TELE COMMUTE ONLY  ****  
      
             WEB PAGE PROGRAMMER

HIGH EXPERIENCE WITH DREAMWEAVER PREFERRED
KNOWLEDGE OF DHTML AND CSS CAPABILITIES OF DREAMWEAVER A+
KNOWLEDGE OF WINDOWS NT 4.0 IIS (server) A+
KNOWLEDGE OF WEB PROGRAMMING: PERL / CGI / JavaScript A +
Knowledge of programming: C / Java  A+

15 TO 40 HOURS PER WEEK  

$15.00 to $25.00 per hour commensurate with experience.

Using a Remote Control software utility called TIMBUKTU,
2 people can work on the same computer simultaneously.

Specific "Log-On' Schedule required. Flexible. 
Prefer Mornings (PST), but afternoons, ok.
2 to 3 hours per remomte 'log-on' session.
2 to 3 times per week. 
Timbuktu has an audio channel and chat features.
High-Bandwidth Not necessary, but PREFERRED. 

Some work done off-line, but this is PRIMARILY a 
real-time, log-on position. Instead of having a
specific schedule at an office, a specific computer
log-on schedule is required.

Please respond directly to:
TeleComMuter@Law.com



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: Wed, 06 Sep 2000 20:51:09 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: INTERNATIONAL PERL TELECOMMUTING
Message-Id: <brian+usenet-1E109E.20510906092000@news.panix.com>

In article <39b6ccf0$3_2@goliath.newsfeeds.com>, 
TelecommutePERL@GlobalWorkInt.com wrote:

> HIGH EXPERIENCE WITH DREAMWEAVER PREFERRED
> KNOWLEDGE OF DHTML AND CSS CAPABILITIES OF DREAMWEAVER A+
> KNOWLEDGE OF WINDOWS NT 4.0 IIS (server) A+
> KNOWLEDGE OF WEB PROGRAMMING: PERL / CGI / JavaScript A +
> Knowledge of programming: C / Java  A+
> 
> 15 TO 40 HOURS PER WEEK  
> 
> $15.00 to $25.00 per hour commensurate with experience.

is that a 15 minute hour?

> Using a Remote Control software utility called TIMBUKTU,
> 2 people can work on the same computer simultaneously.

two programmers at the same time? wow.


now run along before dha gets mad.

-- 
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Wed, 06 Sep 2000 15:13:23 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: memory useage issues
Message-Id: <39B6C183.F7DA5A13@ipac.caltech.edu>

"J. Gregg Thomason" wrote:
> 
> I have a script:

 ... with no '-w' or 'use strict' at the top, thus inviting trouble. Add them to
your script as is and see what happens. You'll get a ton of warnings. And what
you posted won't even compile.

I comment on your code below, but you really need to hit the perl documentation
hard first. Don't just cut/paste code fragments; read!

And please, on your next posting, post code that actually compiles and
demonstrates the problem you're having from a short test case.

> 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;
> }

You're not reading the file. Try something more like ...

open(DOC,"file.dat") or die "can't open file: $!"; 
while(<DOC>) { 
 ... your first loop body here
}

perldoc -f open
perldoc perlop

BTW, you realize don't you, that if the $pid values repeat, only the last will
be available after the loop, right?

>   my $pid=@flds[1];

No. Do this as you did it in the first loop. (You'll get a warning message for
this construction.)

>   if $phys{$pid}[0] eq ""

I think you mean something like

if(defined $phys{$pid} && $phys{$pid}[0] ne "") { ...

As you have it it's both logically wrong and a syntax error.

>     $phone = @flds[8] + @flds[9];

This can't be what you mean. '$flds[8].@flds[9]' maybe?

>     $outline = join("\t", $outline, $pid, @flds[0], $phys{$pid}->[2],

                                            $flds[0]

You don't want $outline repeated in there. This makes $outline grow and grow and
is a source of some of your memory problems. Why not skip defining $outline at
all and simply print the data without the unnecessary join?

printf DOCOUT "...format...",values,...;

> This is killing memory on my machine ...
> ... 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.

Well, after fixing the bugs, the only memory hog will be the %phys hash built
from the first file. The size of the following files won't matter because you
just o/p their data without saving it. How many different pid's can there be,
anyway?

If you really do have a memory problem, the only nice, reasonably fast way I can
think of to allow this to scale arbitrarilly is to use a DBMS. Read 'perldoc
DB_File' and see if you can get the file written as a Berkeley DB file, or write
it that way yourself from the original file as a first pass, then read from it
as shown in the DB_File and 'perldoc -f tie' writeups.

--

-- Tim Conrow         tim@ipac.caltech.edu


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

Date: Wed, 6 Sep 2000 20:29:18 -0400
From: "John Menke" <john@eagleinfosystems.com>
Subject: missing MSPDB60.dll
Message-Id: <39b6e164_1@news.eclipse.net>

Does anyone know where to get this file?  I'm getting this error during
installs.  I have nmake but I get the error missing .dll MSPDB60.dll






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

Date: Wed, 6 Sep 2000 20:39:12 -0400
From: "John Menke" <john@eagleinfosystems.com>
Subject: Re: missing MSPDB60.dll
Message-Id: <39b6e3b4$1_1@news.eclipse.net>

I found it
C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin




John Menke <john@eagleinfosystems.com> wrote in message
news:39b6e164_1@news.eclipse.net...
> Does anyone know where to get this file?  I'm getting this error during
> installs.  I have nmake but I get the error missing .dll MSPDB60.dll
>
>
>
>




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

Date: Wed, 06 Sep 2000 16:51:35 -0700
From: sysnovice <gdonovanNOgdSPAM@jeffco.k12.co.us.invalid>
Subject: Need syntax to specify address to sendmail to fwd all Mail in dir.
Message-Id: <02e54bec.93db0c43@usw-ex0109-069.remarq.com>

I'm writing my first perl script and don't know how to tell
sendmail where to send all the mail in the users directory.
I would appreciate it if anyone could point me to a FAQ or
book that might help me learn how to do this.
Thank You
G.Donovan


opendir(BIN, "/var/spool/mailbox/$MAILBOX/inbox") || die
"Can not find mailbox for " .
"$MAILBOX.: $! \n";
    while(defined ($letters = readdir BIN)) {


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful


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

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


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