[11990] in Perl-Users-Digest
Perl-Users Digest, Issue: 5590 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 7 02:07:08 1999
Date: Thu, 6 May 99 23:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 6 May 1999 Volume: 8 Number: 5590
Today's topics:
Analyzing a perl core <chub@healtheon.com>
Can't load IO.so error when trying to install CPAN modu <tgebhar@hvps.com>
Excel graph using PERL ? tvn007@my-dejanews.com
Re: Expect.pm problems (Charles DeRykus)
Re: Extracting Emails from TXT (Matthew Bafford)
Re: Extracting Emails from TXT <tim@timbury.com>
Re: Frames in Perl Script <upsetter@ziplink.net>
Re: grep to scalar instead of variable?, subroutine exi <jdf@pobox.com>
Re: grep to scalar instead of variable?, subroutine exi <uri@sysarch.com>
Re: Help w/ unique script!! (Tad McClellan)
Re: How to keep travelled path in hash ? (Ronald J Kimball)
Re: how to round off numbers? <khunt@earthlink.net.no-spam>
Re: how to round off numbers? (Tad McClellan)
Re: Making executables from .pl files? <rra@stanford.edu>
MS Access database <hdierking@email.msn.com>
Net::FTP not included in ActivePerl 515? leonandrews@my-dejanews.com
Re: Newbie with a question about a pricing form (Ronald J Kimball)
Re: OReilly bullshit.... Camel logo trademark (Ronald J Kimball)
Re: pattern matching <revjack@radix.net>
Re: Problem with s/foo \|\s// <design@raincloud-studios.com>
Re: Problem with s/foo \|\s// <uri@sysarch.com>
problems with SunOS 5.5 <peace@ovis.net>
processor usage tbsmith@deltacom.net
Re: Q: checking wheather the user exists (John Stanley)
Re: sorting problem solve with Perl (Larry Rosler)
Re: user-defined regex problem (Matthew Bafford)
Re: user-defined regex problem (Larry Rosler)
W: help with creating perl book page entries <uri@sysarch.com>
Re: Which HTTP module for extracting tags? (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 06 May 1999 18:59:55 -0700
From: Bruce Chu <chub@healtheon.com>
Subject: Analyzing a perl core
Message-Id: <3732491A.CE2C2233@healtheon.com>
I'm trying to figure out why perl is dumping core. The name
of my script is 'replicateUsers.pl' and I have a core dump.
When I try and load perl into the debugger with the core
file, it doesn't work because dbx thinks the core file is
from 'replicateUsers' and not perl.
Any way to get around this?
thx
------------------------------
Date: Wed, 5 May 1999 18:16:17 -0400
From: "Tom Gebhardt" <tgebhar@hvps.com>
Subject: Can't load IO.so error when trying to install CPAN modules
Message-Id: <7gqfvi$ad6$1@isrv1.hbocvan.com>
After regenerating perl5.5 patch 2 on a bsdi 4.0 system, I am no longer able
to install any CPAN modules... Full error message received is:
Can't load '/usr/lib/perl5/5.00502/i386-bsdos/auto/IO/IO.so' for module IO:
File not found at /usr/lib/perl5/5.00502/i386-bsdos/Dyna
Loader.pm line 168.
Can anyone help me out with this?
------------------------------
Date: Fri, 07 May 1999 04:54:30 GMT
From: tvn007@my-dejanews.com
To: tinh@rise.com
Subject: Excel graph using PERL ?
Message-Id: <7gtrm5$c5r$1@nnrp1.deja.com>
Hi,
If I have the data as shown below:
(just small sample of data)
---------------------------------
Time speed
0 0
2 10
5 18
9 22
12 25
---------------------------------
I would like to have these data read in MS-Excel table and
automatically graph Time VS. speed.
Would someone help me on this ?
Thanks in advance,
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 7 May 1999 02:47:36 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Expect.pm problems
Message-Id: <FBCD3C.F3v@news.boeing.com>
In article <slrn7j2f7i.2t0.brian@gromit.tatoosh.com>,
Brian Lane <brian@tatoosh.com> wrote:
> Hello,
>
> I'm having a hell of a time getting a simple Expect.pm script to work. I
>ant to be able to use telnet via expect to do some things on my local
>machine. But it keeps hanging after I send the username in response to the
>login: prompt. It acts as if it isn't getting the CR (or CR/LF). I'm running
>on a RedHat 5.1 Linux machine , kernel 2.0.36, perl version 5.004_04 built
>for i386-linux. If I dump it into interact, then I can login normally.
>.....
>print $telnet "user\r";
Did you try just:
print $telnet "user\n";
Can you glean anything from:
$Expect::Debug = 3;
hth,
--
Charles DeRykus
------------------------------
Date: Fri, 07 May 1999 03:06:29 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Extracting Emails from TXT
Message-Id: <slrn7j4l9k.3vd.dragons@dragons.duesouth.net>
On Fri, 7 May 1999 02:02:31 GMT, Miles R. Fidelman <fidelman@world.std.com>
lucked upon a computer, and thus typed in the following:
: Tad McClellan (tadmc@metronet.com) wrote:
: : joeyandsherry@mindspring.com wrote:
: : There have been no breakthroughs in the last several minutes.
: : This still cannot be done.
:
: what's the big deal - you can do this with one line of grep and awk
: commands, probably with sed too - it would take me a little longer in perl
:
: but.. whether it's a GOOD thing to do is another question
Of course, the original author's request (find every @ sign in a file and
read all of the nonspaces before and after it) is quite possible.
I'm sure Tad is talking about extracting email addresses from a message,
which is not (quickly) possible.
--Matthew
------------------------------
Date: Fri, 7 May 1999 00:31:30 -0400
From: "Tim" <tim@timbury.com>
Subject: Re: Extracting Emails from TXT
Message-Id: <926051435.123.20@news.remarQ.com>
Matthew Bafford wrote in message ...
>On Fri, 7 May 1999 02:02:31 GMT, Miles R. Fidelman <fidelman@world.std.com>
>lucked upon a computer, and thus typed in the following:
>: Tad McClellan (tadmc@metronet.com) wrote:
>: : joeyandsherry@mindspring.com wrote:
>: : There have been no breakthroughs in the last several minutes.
>: : This still cannot be done.
>:
>: what's the big deal - you can do this with one line of grep and awk
>: commands, probably with sed too - it would take me a little longer in
perl
>:
>: but.. whether it's a GOOD thing to do is another question
>
>Of course, the original author's request (find every @ sign in a file and
>read all of the nonspaces before and after it) is quite possible.
>
>I'm sure Tad is talking about extracting email addresses from a message,
>which is not (quickly) possible.
>
>--Matthew
Are you guys serious about this or are you just baiting
the spammers? I wrote a short script that does this
quite nicely. Just don't use strict on it... ;->
There is one bug. I noticed (after trying to send email
to folks@worldnett.att) that it isn't getting addresses
having more that two qualifiers in the domain. I guess
I should fix it soon.
Tim K.
------------------------------
Date: Fri, 07 May 1999 02:20:47 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Frames in Perl Script
Message-Id: <36sY2.891$9L5.328432@news.shore.net>
raj999@my-dejanews.com wrote:
: How do I include framsset tags within a Perl script? any clue appreciated.
: Thanks in advance.
print <<END
<FRAMESET>
.
. (whatever)
.
</FRAMESET>
END
Hope this helps,
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 06 May 1999 22:21:41 -0400
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: grep to scalar instead of variable?, subroutine exists?
Message-Id: <m31zgtd3gq.fsf@joshua.panix.com>
Uri Guttman <uri@ibnets.com> writes:
> &{$actions{ (grep(/^btn_/, param()))[0]} || \&default_sub } ;
Job security in one line of Perl, or your money back!
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 06 May 1999 23:37:49 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: grep to scalar instead of variable?, subroutine exists?
Message-Id: <x7so99v9bm.fsf@home.sysarch.com>
>>>>> "JF" == Jonathan Feinberg <jdf@pobox.com> writes:
JF> Uri Guttman <uri@ibnets.com> writes:
>> &{$actions{ (grep(/^btn_/, param()))[0]} || \&default_sub } ;
JF> Job security in one line of Perl, or your money back!
i didn't get paid for that little gem. and i wouldn't use it in my own
production code. i was just answering a request for a one line
dispatcher for a cgi param.
now, in apl it would be job security!
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Thu, 6 May 1999 19:06:54 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help w/ unique script!!
Message-Id: <ea7tg7.fn7.ln@magna.metronet.com>
Bruce (bruce@liquidblue.com) wrote:
: I am in need of a script that we can use to run a contest, ask a survey,
: and have an E-mail entry box. The script also needs to only allow 1 vote
: per IP address. It seems this is a mish-mash of several scripts I have
: seen. What we are going to do is give away a prize. After the visitor
: has answered a question specific to our products, we want the ability to
: have his E-mail written to a text file via a text box, and then also
: grab the IP address so they can only enter once.
: Seems like it is a combination of a "Quiz" or "Survey" script with a
: "Form" script for the E-mail address.
Sounds like you have the Requirements Specification done.
Next step is to design the software.
All that remains is to code it up.
(that may sound a little flip, but if it is truly "unique"
then you are going to have to write it. If it is not
"unique" then why did you say it was in your Subject ?
)
: Anyone have ANY ideas??
If you do it in Perl and get stuck, post a Perl question here.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 7 May 1999 01:34:38 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: How to keep travelled path in hash ?
Message-Id: <1dreslz.7nlu0t5sn7f6N@p185.block2.tc3.state.ma.tiac.com>
Michel Dalle <michel.dalle@usa.net> wrote:
> So mike followed the route post1->post2->post1->post3, and john
> followed the route post3->post1->post2->post2.
>
> Now, what would be the best hash/array structure to keep track of each
> followed path,
I would suggest a hash of lists, as in:
%paths = (
mike => [qw(post1 post2 post1 post3)],
john => [qw(post3 post1 post2 post2)],
);
> and find the most travelled path through my
> website/city/forrest/... ? (I'll have thousands of people walking all over the
> place)
I would suggest a hash from paths to counts. Scan through the list of
paths, and increment a value in a hash for each one.
while(($name, $path) = each %paths) {
$counts{join('->', @{$path})}++;
}
@paths = sort {$counts{$b} <=> $counts{$a}} keys %counts;
Now you have a list of the paths, with the most frequently traveled
paths at the beginning.
HTH!
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 6 May 1999 19:06:35 -0700
From: "KC" <khunt@earthlink.net.no-spam>
Subject: Re: how to round off numbers?
Message-Id: <7gthti$ers$1@ash.prod.itd.earthlink.net>
I'll try to remember that before I try and shoot myself again :-)
: And never let this stuff get to you personally. It's bad for
: your blood pressure, and it doesn't make anyone look good.
:
: David
------------------------------
Date: Thu, 6 May 1999 18:40:35 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how to round off numbers?
Message-Id: <3p5tg7.nk7.ln@magna.metronet.com>
KC (hunt@queen.es.hac.com) wrote:
: Tom Christiansen wrote:
: > A newsgroup is not a manpage server. man perlfunc, search for
: > sprintf.
: >
: > Bye.
: Isn't it? People have questions. They post questions on the ng. Other
: people answer those questions.
: Oh...you must be one of those all-knowing geniuses that only uses the ng
: to post examples of their brilliance.
Ouch!
Making an ass of yourself in front of thousands of people
has gotta hurt.
*plonk*
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 06 May 1999 19:39:12 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Making executables from .pl files?
Message-Id: <ylg159wqlr.fsf@windlord.stanford.edu>
ralawrence <ralawrence@my-dejanews.com> writes:
> Congratulations on managing to insult all those that have released free
> software without open source code. I assume after that little gem you're
> going to delete every bit of free software that you have that doesn't
> come with source code because after all "it isn't worth sharing"?
As someone else said, I was talking about Perl.
But to respond further to what you're saying, I find releasing software
for free without releasing the source to be a fairly pointless activity.
I suppose it makes more sense on Windows systems where the average user
doesn't have a compiler (a crying shame), but even still, what if someone
else could improve your code? If you're giving it away free anyway, why
not share the source?
Any software for which the source code isn't freely available is an
evolutionary dead end. It may be a great idea, and it may help people out
a lot, but it doesn't enter the general knowledge of mankind. Which means
that sooner or later it's going to be rewritten and given away so that it
will. The amount of wasted energy that goes into writing and maintaining
code that's fundamentally a dead end is rather depressing.
I don't write software just because it's part of my job. I write software
because I feel like in so doing I'm contributing to the general knowledge
and available resources of mankind. Every problem that I solve is a
problem that someone else doesn't have to solve, freeing up their time to
solve some other, more interesting problem. Which will hopefully benefit
me in return.
My message was probably too harsh, and for that I apologize. But it's
honestly puzzling to me sometimes why people would choose to have their
hard work be lost in the dustbins of history rather than rolled into the
accumulated programming expertise of all of us. Doing this when you're
giving the software away for free is doubly puzzling, since it can't even
be explained by the understandable human motive of wanting to make money.
Oh, in answer to your last statement, the only two pieces of software I
use regularly for which I don't have source are Solaris and Purify. Both
of them are, in my experience, really solid pieces of software, so my
original statement isn't true in universally. But those are the only two
that I've found worth using over an extended period of time.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Fri, 7 May 1999 00:30:36 -0500
From: "howard dierking" <hdierking@email.msn.com>
Subject: MS Access database
Message-Id: <ujRTeqEm#GA.295@cpmsnbbsa05>
I'm building a simple web app right now where the client wants me to take an
MS Access database (that he has written) and make it into the driving force
behind an interactive Internet solution. The problem that I'm having is
that the client wants to run the site off of Linux/Apache -- and I don't
know how Access works on this kind of scenario. I would like to use Perl to
do the data access. However, I think the first step would be finding out if
this is feasible. So the questions are 1) is there any kind of DBM or ODBC
driver for Access in a Linux/Apache scenario, 2) if so, where can I go about
finding it, and how do I install it, and 3) what Perl modules are out there
to provide support for the data access. As always, any help is greatly
appreciated.
howard
------------------------------
Date: Fri, 07 May 1999 05:08:11 GMT
From: leonandrews@my-dejanews.com
Subject: Net::FTP not included in ActivePerl 515?
Message-Id: <7gtsfq$cuu$1@nnrp1.deja.com>
Hi,
Can anyone tell me why I don't get Net::FTP with the new version of Active
Perl and also why it no longer seems to be available using PPM?
many thanks,
Leon.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 7 May 1999 01:34:44 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Newbie with a question about a pricing form
Message-Id: <1dretj4.1uqb0dth7ig96N@p185.block2.tc3.state.ma.tiac.com>
Matt G. Ellis <mgeusenet@usa.net> wrote:
> I just need to know how to pharse the data.
use CGI;
You can read its documentation with `perldoc CGI`.
P.S. GET and POST are equally easy when you the CGI module.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
perl -e 'for(@ARGV){require $_;print "$_\n $INC{$_}\n"}' CGI.pm
------------------------------
Date: Fri, 7 May 1999 01:34:45 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <1dretoh.co0y7qqetf5lN@p185.block2.tc3.state.ma.tiac.com>
David Cantrell <NukeEmUp@ThePentagon.com> wrote:
> [blah blah blah]
YANAL either.
O'Reilly invented the camel/Perl association. They can do whatever they
want with it. I think they have been quite generous in the permissions
they have already granted for others to make use of it, such as on the
Perl Mongers hats and T-shirts.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 7 May 1999 02:39:39 GMT
From: Gustafson Cossack <revjack@radix.net>
Subject: Re: pattern matching
Message-Id: <7gtjpb$blj$3@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Ronald J Kimball explains it all:
:Riemann Medici <revjack@radix.net> wrote:
:> TRG Software : Tim Greer explains it all:
:>
:> [snip o' doom]
:>
:> You talk too much.
:>
:> *plonk*
:You plonk too much.
:*plonk*
:(Sorry, couldn't resist! ;)
<gesticulating wildly>
--
/~\ Allentown inopportune Midwestern Hess Sims gangway Larry shipbu
C oo safe Vientiane regimentation browbeaten mainstay Parks subversi
_( ^) 1 , 0 0 0 , 0 0 0 m o n k e y s c a n ' t b e w r o n g
/___~\ http://www.radix.net/~revjack/mnj revjack@radix.net
------------------------------
Date: Fri, 07 May 1999 02:51:12 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Problem with s/foo \|\s//
Message-Id: <AysY2.2478$iu1.1908@news.rdc1.tn.home.com>
>I don't know. Each of these regexes works fine for me, which is no
>surprise at all.
>What makes you think it fails? Obviously your real data aren't 'Company
>Name | Page Name', because that would be rather boring, wouldn't it?
>What is the regex you actually used, and some real data?
I feel kinda stupid. :) There were like 69 pages and my search phrase just
happened to turn up 12 where 9 had no page name, but a space after the |
. The 'title' regex was stripping the last space off the title, thus making
the s/ match impossible.
Eh... it happens I guess. :)
CT
------------------------------
Date: 06 May 1999 23:41:49 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Problem with s/foo \|\s//
Message-Id: <x7pv4dv94y.fsf@home.sysarch.com>
>>>>> "CRT" == Charles R Thompson <design@raincloud-studios.com> writes:
>> I don't know. Each of these regexes works fine for me, which is no
>> surprise at all.
>> What makes you think it fails? Obviously your real data aren't 'Company
>> Name | Page Name', because that would be rather boring, wouldn't it?
>> What is the regex you actually used, and some real data?
CRT> I feel kinda stupid. :) There were like 69 pages and my search
CRT> phrase just happened to turn up 12 where 9 had no page name, but
CRT> a space after the | . The 'title' regex was stripping the last
CRT> space off the title, thus making the s/ match impossible.
now here is a good lesson for all of you regex newbies. either handle
worst case possibilities (maybe no white space so use \s? or \s*) or
make ABSOLUTELY sure you have very clean data.
don't assume anything!!
uri (who has done lots of filtering in perl of horrible data)
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Thu, 6 May 1999 22:32:22 -0400
From: Peace Computer Systems <peace@ovis.net>
Subject: problems with SunOS 5.5
Message-Id: <Pine.LNX.3.96.990506222107.8152A-100000@ns1.ovis.net>
anyone ever have a perl script that works flawlessly on linux but not
worth a damn on SunOS 5.5?
even though i get "syntax OK" when i run perl -c filename.cgi, i still get
the big "SERVER ERROR blah blah blah" when i execute the script through a
browser. however, the script runs without a hitch on a linux 5.0 box
(through a browser). any suggestions?
some other info:
version 5.005_02 built for sun4-solaris (when i run perl -v)
version 5.004_04 built for i386-linux (from the linux box)
ps - the code is about 500 lines, i didn't think it appropriate to post it
here.
thanks, paul
------------------------------
Date: Fri, 07 May 1999 05:41:24 GMT
From: tbsmith@deltacom.net
Subject: processor usage
Message-Id: <7gtue4$ed0$1@nnrp1.deja.com>
How can i run a program that uses infinite loops without using 99% of the
processor?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 7 May 1999 05:33:25 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Q: checking wheather the user exists
Message-Id: <7gttv5$i74$1@news.NERO.NET>
In article <x74slpwux5.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
> JS> The file /etc/passwd is not the only map of user names to uids.
>
>i do know that. you have nis/yp, nis+,
yes, yes.
>shadow, nsswitch.conf (solaris), etc.
No, no. Shadow does not map user names to uids, it maps user names to
passwords, and sometimes password expirations. Nsswitch.conf does not
map names to uids, it specifies which maps to use.
>but my point was valid, if he figures out how other programs do it, then
>he could figure out how perl can do it.
I was not replying to what you say is your point. I was replying to the
part I quoted, which asks how you would map without looking in the
password file.
------------------------------
Date: Thu, 6 May 1999 22:40:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sorting problem solve with Perl
Message-Id: <MPG.119c1ca5bae011fc9899f0@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37314FBB.8D88A673@lfi.uni-hannover.de> on Thu, 06 May 1999
10:15:55 +0200, Folkert Meeuw <fmee@lfi.uni-hannover.de> says...
> Hi Dear Friendly Readers,
Grumble, grumble, grumble...
> I want to get out data from one file, sort it with perl and put in
> another file.
> Problem is the data placed in the first file like:
>
> Block1
> Head1 Head2 Head3 ...
> Content1 Content2 Content3 ...
>
> Block2
> Head1 Head2 Head3 ...
> Content1 Content2 Content ...
>
> .
> .
> .
> .
>
> The content1 of Block1 is difficult from the content of Block2.
Perhaps difficult too. But I think you meant 'different'. :-)
> What I need from Perl is that it sorts:
>
> (Block1) (Block2)
> Head1 Head1
> Content1 Content1
>
> (Block1) (Block2)
> Head2 Head2
> Content2 Content2
>
> and store this sort in a new file.
I'll let you do that yourself.
> I think it is possible with other languages like C, but today I need a
> Perl script.
> I' m interest on a script and maybe www-sites where I will find such.
I think you won't find a canned program for such a strange problem. And
I can understand why no one else has answered thus far. Maybe now
someone will try to do it better.
Because it seemed like fun to play with a 3D data structure, I took a
shot at a solution (based on a guess as to what you want). The program
isn't robust against irregular data, but this is only an exercise, nicht
wahr?
#!/usr/local/bin/perl -w
use strict;
my %data; # Might have used an array, but this is easy too.
my $block; # Then the block name would be an index instead.
while (<DATA>) { # Weird stateful data-gathering loop.
chomp;
$block = $_, next unless $block;
$data{$block}[0] = [ split ], next unless $data{$block}[0];
$data{$block}[1] = [ split ], next unless $data{$block}[1];
undef $block; # Got all the data for this block.
}
my @sorted_keys = sort keys %data;
for my $i (0 .. $#{$data{$sorted_keys[0]}[0]}) {
local ($,, $\) = ("\t", "\n"); # As we've been discussing!
print @sorted_keys;
print map $data{$_}[0][$i], @sorted_keys;
print map $data{$_}[1][$i], @sorted_keys;
print "";
}
__END__
Block1
1Head1 1Head2 1Head3 1Head4
1Cont1 1Cont2 1Cont3 1Cont4
Block2
2Head1 2Head2 2Head3 2Head4
2Cont1 2Cont2 2Cont3 2Cont4
Block3
3Head1 3Head2 3Head3 3Head4
3Cont1 3Cont2 3Cont3 3Cont4
Output:
Block1 Block2 Block3
1Head1 2Head1 3Head1
1Cont1 2Cont1 3Cont1
Block1 Block2 Block3
1Head2 2Head2 3Head2
1Cont2 2Cont2 3Cont2
Block1 Block2 Block3
1Head3 2Head3 3Head3
1Cont3 2Cont3 3Cont3
Block1 Block2 Block3
1Head4 2Head4 3Head4
1Cont4 2Cont4 3Cont4
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 07 May 1999 03:06:27 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: user-defined regex problem
Message-Id: <slrn7j4l3e.3vd.dragons@dragons.duesouth.net>
On Thu, 6 May 1999 18:37:43 -0700, Larry Rosler <lr@hpl.hp.com>
lucked upon a computer, and thus typed in the following:
: [Posted and a courtesy copy mailed.]
: eval "s/$old/$new/g";
:
: Of course, you need checks on the result of the eval, because you can't
: trust user input for syntactic correctness. Fortunately, I think you
: are safe from semantic malice, because there is no /e on the regex.
What if new contained '/;system("rm -rf /")s//'?
--Matthew
------------------------------
Date: Thu, 6 May 1999 21:32:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: user-defined regex problem
Message-Id: <MPG.119c0caf1f4652b09899ef@nntp.hpl.hp.com>
In article <slrn7j4l3e.3vd.dragons@dragons.duesouth.net> on Fri, 07 May
1999 03:06:27 GMT, Matthew Bafford <dragons@dragons.duesouth.net>
says...
> On Thu, 6 May 1999 18:37:43 -0700, Larry Rosler <lr@hpl.hp.com>
> lucked upon a computer, and thus typed in the following:
> : eval "s/$old/$new/g";
> :
> : Of course, you need checks on the result of the eval, because you can't
> : trust user input for syntactic correctness. Fortunately, I think you
> : are safe from semantic malice, because there is no /e on the regex.
>
> What if new contained '/;system("rm -rf /")s//'?
^;
but I get the point. I did say "I think you are safe", but I didn't
think deeply (or deviously) enough. I guess nothing is safe. :-(
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 07 May 1999 01:17:24 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: W: help with creating perl book page entries
Message-Id: <x7lnf1v4pn.fsf@home.sysarch.com>
i have developed a perl books page that i want to share and i need help
in creating more entries for it. my goal is to make this THE
comprehensive perl book page with every book with perl in its title or
which covers perl in some serious depth. many people have asked about
such a page and i think we need it. each book will be described with all
the standard info like author, publisher, list price, page count, isbn,
etc. as well as links to its home page, table of contents, excepts,
errata, reviews and more.
if anyone wants to post a review or a link to one i will be glad to add
them. i may add my own star/camel ratings and i will definitely have my
own reviews there too. some of you may have seen my recent post of a
flaming review of "perl: an incomplete reference". comments on the page
are welcome too. i am not a web designer so my html layout can be
improved in many ways. one longer term goal is to be able to
expand/compress each book entry in the list (with cute right or down
facing triangles!). so if any of you have these skills and want to help,
feel free to mail me.
you can scroll thru a list of books and show any of the links in a
second frame. it can support no-frames too. also you can request to show
the current prices of a book from 6 different web book sites (more can
easily be added as it is hash driven). links to the book at those
buying sites are there too. i may add buy thru me links (so i would get
%15 commission from some of them) but i am not set on that. if i did
that would that affect your support for the page?
its design and code is done and i need to populate it with more perl
books. i currently have the camel, cookbook and advanced perl in there
which i have used for development and testing.
the page is driven from a list of hashes each of which has the info and
links for a given book. so if you are interested in creating entries for
books or want to play with the site, email me and i will send you the
hash structure and site url. i don't want to expose it to
the public yet so i won't put that info here so this will be by mail
only for a while. you can send me back the hash filled with
the info for a book not yet in the list. if a bunch of you help me out,
we can get this to a few dozen books very quickly and then i will make
it public. i also may be switching virtual host servers soon so that is
another reason i don't want to make this public yet.
i am going away for a week on sunday so get back to me quickly and i
will send you the info.
as a technical note, when i get the prices i fetch the pages
sequentially but i send all the GET's first and then read from
them. next i will develop a true parallel GET which will use select and
be much faster and that'll be a fun project. that will be a generalized
mechanism which i may put on cpan some time later.
the code will stay private for a while as it get developed more. i do
want to keep control of this site and since it is a single script with
all the data inside, posting the code will ruin that for me. maybe i
will get hit by the spirit and release it at some point after i make my
millions in commissions. :-)
all who help me out with entries or other work will get credit on the
splash page (which is currently just black).
thanx,
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Thu, 6 May 1999 18:59:41 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Which HTTP module for extracting tags?
Message-Id: <ts6tg7.fn7.ln@magna.metronet.com>
Charles R. Thompson (design@raincloud-studios.com) wrote:
: I'm looking on CPAN and seeing a bit too much. Which HTTP module will allow me
: the quickest way to extract text between specific HTML tags with the least
: amount of overhead? I also need it to handle tags across newlines.
: Say if I wanted to jerk just the title out of a page or get an array of all
: the a href links. That kind of simple flexibility.
use HTML::Parser;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5590
**************************************