[17718] in Perl-Users-Digest
Perl-Users Digest, Issue: 5138 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 18 03:10:31 2000
Date: Mon, 18 Dec 2000 00:10:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977127016-v9-i5138@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 18 Dec 2000 Volume: 9 Number: 5138
Today's topics:
Re: One-Liner to Sum a Stack of Numbers? (Andrew N. McGuire)
Re: perl vote script. (Randal L. Schwartz)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (John Stanley)
RegEx: \s but not \n <johnlin@chttl.com.tw>
Re: RegEx: \s but not \n (Martien Verbruggen)
Re: RegEx: \s but not \n (Sean McAfee)
Re: Sendmail script problems (Richard Zilavec)
Re: Splitting data into an array <jeffp@crusoe.net>
Re: Splitting data into an array <harrisr@bignet.net>
Re: Splitting data into an array <uri@sysarch.com>
Re: Splitting data into an array <harrisr@bignet.net>
Thanks for your help <rvdzant@planet.nl>
Re: Thanks for your help (Tad McClellan)
time, schedules, advice <ng@fnmail.com>
Re: Total Beginner (Abigail)
Re: Trick problem, Selective purging of a directory? <harrisr@bignet.net>
Re: Trick problem, Selective purging of a directory? (Rafael Garcia-Suarez)
Upload Image don't refresh martinnitram@excite.com
Re: Use PERL or Java? Which is faster? (Mark W. Schumann)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Dec 2000 01:08:36 -0600
From: anmcguire@ce.mediaone.net (Andrew N. McGuire)
Subject: Re: One-Liner to Sum a Stack of Numbers?
Message-Id: <86hf42dx57.fsf@hawk.ce.mediaone.net>
[ first, let me apologize for stealth cc'ing you Abigail, I had a slip
of the fingers, specifically 'R' instead of 'F'. :-( ]
>>>>> "A" == Abigail <abigail@foad.org> writes:
A> On Sat, 16 Dec 2000 01:20:06 GMT, SuperGumby (tick.toff@spam.com) wrote in comp.lang.perl.misc <URL: news:<arz_5.19724$xW4.156568@news-server.bigpond.net.au>>:
A> ++ OK OK, having just commented in another post on the proliferation of
A> ++ oneliners,,, How can this be described as a oneliner ? Theoretically it
A> ++ seems to me any perl program can be written sans <cr> but this thing has a
A> ++ 'statement terminator' in the middle of it.
A> Perl doesn't have statement terminator.
[ snip ]
Sure it does, ';' is a statement terminator.
anm
--
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'
------------------------------
Date: 17 Dec 2000 22:07:07 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: perl vote script.
Message-Id: <m18zpeclf8.fsf@halfdome.holdit.com>
>>>>> "johnvert" == johnvert <johnvert@my-deja.com> writes:
johnvert> Hi, I'm not sure if this is the right place to ask this, but
johnvert> I'm only looking for a pointer: I want a very simple poll
johnvert> script just like the one on http://www.slashdot.org. It's
johnvert> not difficult to do myself but it's been written so many
johnvert> times it's ridiculous to reinvent it. I thought it would be
johnvert> a piece of cake to find stuff like this on google, but I
johnvert> couldn't. Does anyone know where I can get it?
My upcoming WebTechniques column has exactly that.
It'll be online in February. Sorry, I can't reveal it before that.
Past columns (and this one, after February) are at
http://www.stonehenge.com/merlyn/WebTechniques/
and check out these two archives as well for ideas:
http://www.stonehenge.com/merlyn/UnixReview/
http://www.stonehenge.com/merlyn/LinuxMag/
print "Just another Perl hacker," # with 117 magazine column by-lines... :)
--
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: 18 Dec 2000 06:47:49 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91kbul$58a$1@news.NERO.NET>
In article <u5ln3tsumgepf2gq93fcu6i58pq77jg7q0@4ax.com>,
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.li> wrote:
>I think I knew that.
Now you know it for sure.
>I should have been more specific, I suppose.
If you don't want me to have to guess what you are asking about, that's
a good plan.
>Why "USENET" and not "Usenet" or "usenet"? I rather doubt it's an acronym.
Because that is the way it is traditionally written. That's the way it
was written when I got here and I see no reason to change.
------------------------------
Date: Mon, 18 Dec 2000 10:02:34 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: RegEx: \s but not \n
Message-Id: <91jrc5$97i@netnews.hinet.net>
Dear all,
When I want to match
\s but not \n
I write
[ \t\r\f]
which might be buggy because my enumeration of \s might be wrong.
Besides, I know \s has more elements in UTF8, right?
Even worse, for
\w but not [aeiou]
I write
[A-Zb-df-hj-np-tv-z0-9_]
Hmm... this might be buggy, too.
Is there a better expression for this kind of matching?
Thank you.
John Lin
------------------------------
Date: Mon, 18 Dec 2000 02:37:57 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: RegEx: \s but not \n
Message-Id: <slrn93qu02.j5f.mgjv@verbruggen.comdyn.com.au>
On Mon, 18 Dec 2000 10:02:34 +0800,
John Lin <johnlin@chttl.com.tw> wrote:
> Dear all,
>
> When I want to match
>
> \s but not \n
>
> I write
>
> [ \t\r\f]
Hmmm... One way of matching all whitespace except newline:
/(?!\n)(\s)/
I'm not sure whether there are others.
> Even worse, for
>
> \w but not [aeiou]
>
> I write
>
> [A-Zb-df-hj-np-tv-z0-9_]
/(?![aeiou])(\w)/
But you might be missing out on what your locale considers to be
vowels. I don't know of any way except enumeration to find all the
vowels in a locale. Maybe someone else knows.
Martien
--
Martien Verbruggen |
Interactive Media Division | 42.6% of statistics is made up on the
Commercial Dynamics Pty. Ltd. | spot.
NSW, Australia |
------------------------------
Date: Mon, 18 Dec 2000 03:13:49 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: RegEx: \s but not \n
Message-Id: <Nhf%5.11066$O5.296665@news.itd.umich.edu>
In article <91jrc5$97i@netnews.hinet.net>,
John Lin <johnlin@chttl.com.tw> wrote:
>When I want to match
> \s but not \n
>I write
> [ \t\r\f]
>which might be buggy because my enumeration of \s might be wrong.
>Besides, I know \s has more elements in UTF8, right?
The usual way to match this is [^\S\n].
>Even worse, for
> \w but not [aeiou]
>I write
> [A-Zb-df-hj-np-tv-z0-9_]
Similarly to the above case, write [^\Waeiou].
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Mon, 18 Dec 2000 02:40:22 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Sendmail script problems
Message-Id: <3a3d7837.859902210@news.tcn.net>
On Sat, 16 Dec 2000 23:11:39 GMT, Mike Lin <mikelin6@home.com> wrote:
>#!/usr/local/bin/perl
You should consider using -w.
>open (MAIL, "|/usr/bin/sendmail -t") || &MailError;
Other than your &MailError, this code ran as expected on my machine.
>script there. Basically, I can't check what the error messages are. I
You should be able to check the webserver error_log, the answer your
looking for, might be in there.
--
Richard Zilavec
rzilavec@tcn.net
------------------------------
Date: Sun, 17 Dec 2000 20:36:15 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Splitting data into an array
Message-Id: <Pine.GSO.4.21.0012172021570.22284-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 17, Hawk said:
>12-15-00
>entry1
>entry2
>entry3
>entry4
>12-15-00 END
>12-16-00
>entry1
>entry2
>12-16-00 END
>
>Say I want to take all of the data between 12-15-00 and 12-15-00 END and
>print it, how would I accomplish that?
I'd modify $/ so that records end in " END\n" instead of "\n".
#!/usr/bin/perl -w
use strict;
$/ = " END\n";
@ARGV or die "usage: $0 date [filename]\n";
my $date = quotemeta(shift);
while (<>) {
print, last if /^$date\n/o;
}
The program is used as follows (assuming it's named recread):
japhy% ./recread 12-16-00 filename
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Sun, 17 Dec 2000 23:14:57 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: Splitting data into an array
Message-Id: <t3r3ou5stqvrb5@corp.supernews.com>
Uri Guttman <uri@sysarch.com> wrote in message
news:x7ofyag1ym.fsf@home.sysarch.com...
> >>>>> "H" == Hawk <someguyREMOVE@REMOVEsunflower.com> writes:
>
> H> Hello,
> H> I have a flat text database that has many lines like this
> H> 12-15-00
> H> entry1
> H> entry2
> H> entry3
> H> entry4
> H> 12-15-00 END
> H> 12-16-00
> H> entry1
> H> entry2
> H> 12-16-00 END
>
> H> and so on.
>
> H> Say I want to take all of the data between 12-15-00 and 12-15-00
END and
> H> print it, how would I accomplish that?
>
> perl -ne 'print if /^12-15-00$/ .. /^12-15-00 END$/' file
Uri, wouldn't that make the output inclusive of the dates, where the OP
wanted the lines between the dates?
> uri
>
> --
> Uri Guttman --------- uri@sysarch.com ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page -----------
http://www.sysarch.com/cgi-bin/perl_books
> The Best Search Engine on the Net ----------
http://www.northernlight.com
------------------------------
Date: Mon, 18 Dec 2000 04:38:06 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Splitting data into an array
Message-Id: <x7itoifioh.fsf@home.sysarch.com>
>>>>> "RH" == Randy Harris <harrisr@bignet.net> writes:
RH> Uri Guttman <uri@sysarch.com> wrote in message
RH> news:x7ofyag1ym.fsf@home.sysarch.com...
>> >>>>> "H" == Hawk <someguyREMOVE@REMOVEsunflower.com> writes:
>>
H> Say I want to take all of the data between 12-15-00 and 12-15-00
RH> END and
H> print it, how would I accomplish that?
>>
>> perl -ne 'print if /^12-15-00$/ .. /^12-15-00 END$/' file
RH> Uri, wouldn't that make the output inclusive of the dates, where the OP
RH> wanted the lines between the dates?
true. so modify it like this:
perl -ne 'print if ($r = /^12-15-00$/ .. /^12-15-00 END$/) and $r > 1
and $r !~ /e/i' file
that will skip the first and last lines of the range.
learn to not only use the scalar range operator but the nuances of its
return value which has some useful quirks.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Mon, 18 Dec 2000 00:50:38 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: Splitting data into an array
Message-Id: <t3r9cehcek3586@corp.supernews.com>
Uri Guttman <uri@sysarch.com> wrote in message
news:x7itoifioh.fsf@home.sysarch.com...
> >>>>> "RH" == Randy Harris <harrisr@bignet.net> writes:
>
> RH> Uri, wouldn't that make the output inclusive of the dates, where
the OP
> RH> wanted the lines between the dates?
>
> true. so modify it like this:
>
> perl -ne 'print if ($r = /^12-15-00$/ .. /^12-15-00 END$/) and $r > 1
> and $r !~ /e/i' file
>
> that will skip the first and last lines of the range.
>
> learn to not only use the scalar range operator but the nuances of its
> return value which has some useful quirks.
>
> uri
Thanks. I re-read perlop after your original post to figure out how
that worked.
------------------------------
Date: Mon, 18 Dec 2000 01:47:29 +0100
From: "R.C. van der Zant" <rvdzant@planet.nl>
Subject: Thanks for your help
Message-Id: <3A3D5EA1.8EE05FD3@planet.nl>
As it's been a while since I posted my problem with : Perl, Oracle and
Apache in this newsgroup and it no longer is possible (for me) to find
the person who helped solve the problem by mentioning the setenv
directive in the conf file for Apache, I hope this message reaches him.
You were a great help, thanks very, very much !
Ronald van der Zant
Den Haag
Holland
------------------------------
Date: Sun, 17 Dec 2000 20:16:25 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Thanks for your help
Message-Id: <slrn93qpb9.39h.tadmc@magna.metronet.com>
R.C. van der Zant <rvdzant@planet.nl> wrote:
>it no longer is possible (for me) to find
>the person who helped solve the problem
A searchable archive of newsgroup postings:
http://www.deja.com/home_ps.shtml
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 17 Dec 2000 23:54:48 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: time, schedules, advice
Message-Id: <91k90k$jm0$1@info1.fnal.gov>
I am making a webpage for alocal tv station.
I would like some advice on the schedule system.
I want to beable to display the schedule by calling a function that takes
two(or three) arguments, date,time, duration.
and have it display a grid (table) with the times and the shows.
I would like some advice on how to store this info in a datafile.
specifically the date/time info
timezones is not a problem because this page will only be used by people
locally.
I'm thinking of storing it like this
date,time,duration of show,name of show,description
I just want an easy way to store the date and time.
--
Enrico Ng <ng@fnmail.com>
------------------------------
Date: 18 Dec 2000 01:15:57 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Total Beginner
Message-Id: <slrn93qpad.qq1.abigail@tsathoggua.rlyeh.net>
On Fri, 15 Dec 2000 18:59:30 -0000, Sandra Pearce (sandy12574@ic24.co.uk) wrote in comp.lang.perl.misc <URL: news:<91dpkd$d61$1@newsg2.svr.pol.co.uk>>:
++ Hi,
++
++ Any good sites for a total beginner to perl....
++ I want to create some CGI scripts.
$ cat > my_first_cgi
#!/opt/perl/bin/perl -wT
use strict;
use CGI;
... details ...
__END__
^D
$ chmod 755 my_first_cgi
$
Just fill in the details and you're done!
Abigail
------------------------------
Date: Sun, 17 Dec 2000 23:21:05 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: Trick problem, Selective purging of a directory?
Message-Id: <t3r44fba47f745@corp.supernews.com>
Tom Christiansen <tchrist@perl.com> wrote in message
news:3a3c5c7b@cs.colorado.edu...
> In article <t3oh2vildapq03@corp.supernews.com>,
> Randy Harris <harrisr@bignet.net> wrote:
> >Someone will probably give you a good Perl way to do this, but in
case
> >not...
> >
> >rm `ls -t | tail -n +30`
> >
> >in Unix, will delete all files older than the first 30.
>
> Not just "in Unix", you know. Anywhere you've got those three
> commands--which, of course, should be everywhere. PPT, and all.
>
> --tom
Ya, I've got those and a bunch of others on my NT box. The DOS command
shell is pretty feeble.
------------------------------
Date: Mon, 18 Dec 2000 07:59:07 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Trick problem, Selective purging of a directory?
Message-Id: <slrn93rgtk.8if.rgarciasuarez@rafael.kazibao.net>
Tom Christiansen wrote in comp.lang.perl.misc:
> >
> >rm `ls -t | tail -n +30`
> >
> >in Unix, will delete all files older than the first 30.
>
> Not just "in Unix", you know. Anywhere you've got those three
> commands--which, of course, should be everywhere. PPT, and all.
There is actually four commands in this line : don't forget the shell,
that interprets `` and |. And PPT has not yet an implementation of sh
available, has it?
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Mon, 18 Dec 2000 03:47:57 GMT
From: martinnitram@excite.com
Subject: Upload Image don't refresh
Message-Id: <91k1dc$quh$1@nnrp1.deja.com>
Dear all,
I used the CGI.pm to upload the image and it done successfully. But
if let user to re-submit the form and the saving file name is the same
(say, hardcord the image name as tmp.gif), when use <img src=tmp.gif>
to show the image, it always keep to show first one uploaded. I had
tried to use http-expire for both HTML and CHI-header to force the page
expire but still no effect. Any one had suggestion to solve this
problem? (apert from use another cgi to read and write the content)
Thx a lot.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 17 Dec 2000 23:40:29 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <91k4ft$6dr@junior.apk.net>
In article <3A36A19E.A8247D0@yvtugubhfrovm.pbz>,
kevin metcalf <xzrgpnys@yvtugubhfrovm.pbz> wrote:
>"Randal L. Schwartz" wrote:
>>
>> >>>>> "Mark" == Mark W Schumann <catfood@apk.net> writes:
>>
>> Mark> If speed is your top priority, forget both. Lovingly hand-optimized
>> Mark> machine code is fastest of all.
>>
>> No! If speed is your top priority, skip machine code. Go right to
>> microcode or hardwired logic!
>
>Yeah! Just get out your microscope and tweasers and "optimize" your
>ALU! That would be LOTS faster! :)
Faster still would be to pick a language and learn it well.
Which was my real point.
------------------------------
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 5138
**************************************