[7181] in Perl-Users-Digest
Perl-Users Digest, Issue: 806 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 2 00:22:49 1997
Date: Fri, 1 Aug 97 21:00:26 -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 Fri, 1 Aug 1997 Volume: 8 Number: 806
Today's topics:
Re: !Capture who command results (Tad McClellan)
Re: [Q] Checkbox forms in Perl <dyrewolf@worldnet.att.net>
Re: [Q] Checkbox forms in Perl <dyrewolf@worldnet.att.net>
Re: A PUZZLE <rootbeer@teleport.com>
Re: A simple perl question... <helmrl@aur.alcatel.com>
Re: Arrays and the value they return... <mark@tstonramp.com>
Re: Calculating distances in Perl? (Jim Michael)
Re: CGI server internal error <kraina@geocities.com>
Re: CGI.pm file uploads with Internet Explorer (Plastic Nuclear Ferret)
Re: comments in regular expressions (wish list) (Pete Jordan)
Re: Evaluating Strings <kraina@geocities.com>
Re: file extensions (Tad McClellan)
Re: flocking files.... <westxga@ptsc.slg.eds.com>
Help: unlink arguments don't work?? <bi@inside.ch>
Re: Help: unlink arguments don't work?? <jhi@alpha.hut.fi>
I'm looking for Perl, C, Python, JS, Java, etc. URL arc <abagi@idk.com.pl>
Is it possible? dschlot@george.arc.nasa.gov
Re: look at this <kraina@geocities.com>
Re: matching , in a reg expr <rootbeer@teleport.com>
Re: Matching... <sfairey@adc.metrica.co.uk>
NEWBIE HELP (Dalinka1)
Re: newbie: Sorting a Flat File (Eric Bohlman)
Re: Newbie: Why won't help work on my mac? <rootbeer@teleport.com>
Nobbling "Sender" field in rn? (David Regis)
Re: NT Perl Sources and problem <rootbeer@teleport.com>
OLE with Perl <serginho@alpha.hydra.com.br>
Re: Print Web Page a la netscape <Joe.Kline@sdrc.com>
Re: printing (Eric Bohlman)
Re: Problems with tie/DB_File/references (Jeff Stampes)
Re: Questions regarding speed of grep EXPR <sfairey@adc.metrica.co.uk>
Re: Regexp for postal address? (Michael Schuerig)
sprintf padding question (Tim Gray)
Re: Stripping ^M from a variable. How? (A. Deckers)
Sum v Perl ( Thomas Lachlan XMS x4206 )
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 31 Jul 1997 06:35:30 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: !Capture who command results
Message-Id: <2atpr5.ik.ln@localhost>
Lauri Laakso (lauri@samoilu.net) wrote:
: When I type who I get...
: paja:/lauri$ who
: lauri ttyp0 Jul 30 18:48 (paja.samoilu.net)
: inkinen ttyp3 Jul 30 16:39 (cypress.samoilu.)
: paja:/lauri$
: ....how do i get those (2 in this example) lines?
@lines = `who`; # backticks
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Thu, 31 Jul 1997 06:28:40 -0700
From: Adam Grayson <dyrewolf@worldnet.att.net>
Subject: Re: [Q] Checkbox forms in Perl
Message-Id: <33E09308.2A42@worldnet.att.net>
Greg Zevin wrote:
>
> Both advices are correct. I tried both and the first one
> looks easier to program. If you use CGI.pm, then it will be easy
> to get all ticked checkboxes' values, e.g:
>
> @checkboxes = param('checkboxes'); (where'checkboxes' is the name
> of your checkboxes).
>
> Hope this helps
>
> Greg Zevin
>
That sounds like some damn fine advice. The easiest I've heard so far.
Thanks!
Adam
------------------------------
Date: Thu, 31 Jul 1997 06:27:17 -0700
From: Adam Grayson <dyrewolf@worldnet.att.net>
Subject: Re: [Q] Checkbox forms in Perl
Message-Id: <33E092B5.1663@worldnet.att.net>
Jack Lawrence wrote:
>
> Along those lines...
> Is it possible to, after a list of items with checkboxes, to have a single
> checkbox that will either select or deselect the entire list of checkboxes?
>
> Jack Lawrence
>
Now that my Perl question has been answered on the subject, I can
suggest that the above be done with JavaScript. You can write an onClick
function on that one magic box, and change all of the other checkboxes
to on with it.
Adam
------------------------------
Date: Thu, 31 Jul 1997 07:20:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Neil Edmondson <neiled@enteract.com>
Subject: Re: A PUZZLE
Message-Id: <Pine.GSO.3.96.970731071238.20106K-100000@kelly.teleport.com>
On 29 Jul 1997, Neil Edmondson wrote:
> Subject: A PUZZLE
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> However, just today (after three months of no problems) my "next number"
> was reset to 000001 (it had been up in the 00100x range). It would
> appear to me that the file somehow got deleted. And I didn't do it!
> Honest!
>
> Can anyone offer another explanation. And yes the flocks really are
> commented out on the UNIX system where this happened.
That's no puzzle. :-) If you know that you're not using flock, you know
why your file got wiped out. I think you could use the methods in Randal's
fourth Web Techniques column.
http://www.stonehenge.com/merlyn/WebTechniques/
If it happens that you might need to run a flocking script on a machine
without flock, put this sort of thing at the top of your script. It turns
flock into a no-op if it's not implemented. (Of course, you might still
have problems on the machine where you're not using flock. :-)
BEGIN {
# Make a fake flock if there's no flock
eval q{ flock STDOUT, 0 };
eval q{ sub flock { 1 } } if $@;
}
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 31 Jul 1997 15:53:12 -0400
From: "Ron L. Helms" <helmrl@aur.alcatel.com>
To: Lambeau Net Webmaster <cheese@iwshome.com>
Subject: Re: A simple perl question...
Message-Id: <33E0ED28.167EB0E7@aur.alcatel.com>
Lambeau Net Webmaster wrote:
>
> Hi. I have a simple question that I need answered. I have this id script
> that I made and I need it so that when a person doesn't enter the id in the
> correct format (2 letters first followed by 6 numbers) it prints an error
> page. I think it goes something like this, but this doesn't work-
>
> if ($FORM{'id'} eq #something goes here# ) { #If the id is 2 letters
> followed by 6 numbers, it will do the next step.
Actually, try $FORM{'id'} =~ /^[A-Za-z]{2}[0-9]{6}$/
That says at the beginning find 2 and only 2 characters, followed by
6 and only 6 numbers and then end. It will not match a space followed by
2 chars and 6 nums, nor will it match 2 chars, 6 nums and a newline.
If you only want uppercase letters, do [A-Z].
Hope this helps.
Ron Helms
------------------------------
Date: Thu, 31 Jul 1997 22:51:41 -0700
From: "Mark J. Schaal" <mark@tstonramp.com>
Subject: Re: Arrays and the value they return...
Message-Id: <33E1796D.1EB5@tstonramp.com>
Michael Ching wrote:
>
> I know that @array either a string of all the elements space
> separated, or the number of elements. When I pass @array to a
> subroutine, it just gives me the count, I want it to give me each one
> as an element of @_; Pretty much I need to determine which is going
> to be used. thanks.
Like everywhere else, what is used is determined by the context
of the usage. It would have been better to post some code
showing your problem, but perhaps the following will help
to illustrate.
@list = ('red', 'blue', 'green');
&test1(@list);
&test2(@list);
sub test1
{
$scalar_var = @_;
print "$scalar_var \n";
}
sub test2
{
@list_var = @_;
print "@list_var, \n";
}
hope this helps,
mark
--
Mark J. Schaal TST On Ramp Sysadm mark@tstonramp.com
------------------------------
Date: Sat, 2 Aug 1997 02:23:58 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Calculating distances in Perl?
Message-Id: <genepoolEE9LBy.DJs@netcom.com>
Javier Vegas (javier@sloan.salk.edu) wrote:
: Hello
Howdy
: In order not to reinvent the wheel, I am
: looking for a function/package/library/thingy
: that calculates the distance between two points
: on earth when I know their latitude and longitude.
I am not aware of anything perl-specific, but there is a GPS newsgroup
where pointers to the general algorithms may be found. I would try a
search on DejaNews with search terms 'gps great circle calculation',
using the old database. Email if you need additional help.
Cheers,
Jim
------------------------------
Date: Fri, 01 Aug 1997 16:53:20 -0700
From: Kapil Raina <kraina@geocities.com>
To: PAUL YAN <PAUL_YAN@non-hp-paloalto-om15.om.hp.com>
Subject: Re: CGI server internal error
Message-Id: <33E276F0.D01@geocities.com>
If I am not mistaken you need to put TWO "\n" after the print header
statement. This is very strict in that if you dont have it, the web
server will not be able to print anything out and result in the error
you saw. See below...
Hope that fixes the problem!
PAUL YAN wrote:
>
> Hello, gurus:
> I just wanna write a script that print out the webpage but the server
> always give the error like :
>
> Server Error
>
> This server has encountered an internal error which prevents it from
> fulfilling your request. The most likely cause is a misconfiguration.
> Please ask the administrator to look for messages in the server's error
> log.
>
> and errors log is :
>
> [28/Jul/1997:09:46:32] failure: for host xxx.xxx.xxx.xxx trying to GET
> /cgi-bin/showEvent.pl, cgi-parse-output reports: the CGI program
> /opt/ns-http/docs/cgi-bin/showEvent.pl did not produce a valid header
> (name without value: got line "<html>
> ")
>
> myscript is :
>
> #!/usr/local/bin/perl
>
> $Version = "Demo alpha 1.0";
>
> # if ($ENV{'QUERY_STRING'} =~ /Month=(\d+)\&Date=(\d+)\&Year=(\d+)/) {
> # &DisplayEvent($1, $2, $3);
> # }
>
> &DisplayEvent();
>
> exit;
> # End of Main
> sub DisplayEvent {
> local($Month,$Date, $Year)=@_;
> $Month = $Month + 1;
> &printHTMLheader;
>
> open(FH, '/root/http/docs/test/event');
> while (<FH>) {
> chop;
> print '<P>'.$_.'<BR></P>';
> print "\n";
> }
> &printHTMLfooter;
> }
>
> sub printHTMLheader {
> print 'Content-type: text/html';
> print "\n";
change the above two files to print "Content-type: text/html\n\n";
> print '<HTML>';
> print "\n";
> print '<BODY BGCOLOR="#FFFFFF" text="#000000">';
> print "\n";
> }
>
> sub printHTMLfooter {
> print '</BODY>';
> print "\n";
> print '</HTML>';
> print "\n";
> }
>
> What is wrong with it ? I need a hand !
------------------------------
Date: 1 Aug 1997 16:59:02 GMT
From: donut@bayarea.net (Plastic Nuclear Ferret)
Subject: Re: CGI.pm file uploads with Internet Explorer
Message-Id: <5rt4km$kkq$1@news.bayarea.net>
Petri Backstrom (petri.backstrom@icl.fi) wrote:
: Shows you don't know what I was talking about...
: Well, perhaps I'm the bigger fool for not being clearer, but shame on
: you
: too for not being as polite in your wording as you could've been - not
: that I am always either ;-)
: Anyway, at least on Windows NT 4.0 SP3 with Netscape Navigator 3.01, if
: I
: hit the "Browse" button that
: <input type="file" name="whatever">
: creates, then the "File Upload" dialog has a filter (field named "Files
: of type") that defaults to "HTML Files", and all that's listed are
: directories ("folders" in Microsoft terms) and HTML files.
: This is - mind you - without any CGI scripts or modules around. ;-)
: Does Navigator behave differently on non-Windows platforms? (I've only
: had brief exposure to Navigator on a couple of UNIX workstations.) Or
: is there a way to force or suggest a different default filter for when
: the "File Upload" dialog pops up? (Well, I don't expect an answer here,
: since this hasn't really anything to do with Perl; I just felt that
: I had to respond.)
: With the latest Internet Explorer 3.02 (Microsoft has released at least
: a couple of different builds all "3.02" - my current one is 4.70.1300)
: and RFC1867.EXE installed, the "File Upload" dialog has an empty filter
: for "Files of type") and all files are listed in a directory (and that's
: the part that's "better than Netscape Navigator" in my case).
: Oh, and I do upload all kinds of files too (executables, word processor
: docs, SGML files, HTML files, ZIP archives, etc.).
: I use CGI.pm in the CGI scripts to handle the actual uploading part,
: FWIW
: (I had to get at least a little Perl content into my response :-)
yeah, the default for netscrape are .html files (ive done a few file uploading
scripts). dunno about interhell explorer.....
and afaik, ther is no way to change the defualt to something other that .html
files.
later-
shane
--
###############################################################################
# Shane Knapp # donut@bayarea.net # skknapp@nas.nasa.gov #
# "I'd like to be Superman, but you're standing on my cape...." #
# http://www.bayarea.net/~donut #
###############################################################################
------------------------------
Date: Fri, 01 Aug 1997 10:50:09 GMT
From: pete@horus.cix.vapethis.co.uk (Pete Jordan)
Subject: Re: comments in regular expressions (wish list)
Message-Id: <memo.19970801115008.45199B@horus.cix.co.uk>
Joe Buehler <jbuehler@hekimian.com> wrote:
> Along this line, it would be nice to be able to be able to
> stuff the matching portions of a pattern into named variables:
>
> $x =~ /(?>$var:some_pattern)(?>$var2:some_pattern_2)/;
Hmmm. I like that.
Pete Jordan
= = = = = = = = = = = = = = = = = = = = = = =
Horus Communications
http://www.horus.cix.co.uk/
= = = = = = = = = = = = = = = = = = = = = = =
"Is a polar bear a rectangular bear after
a coordinate transform?"
------------------------------
Date: Fri, 01 Aug 1997 17:35:12 -0700
From: Kapil Raina <kraina@geocities.com>
To: Chris Bradley <info@toronto-red-lite.com>
Subject: Re: Evaluating Strings
Message-Id: <33E280C0.930@geocities.com>
Try this...
$lcuser = "Frank";
print "x=search.pl?user=$lcuser";
The print statement will evaluate all "$" variables automatically. Also
keep in mind that in your code below you used '' single quotes around
Frank and that has different meaning than "" double quotes in Perl.
Look up which used for what, but in this case I think you wanted ""
around Frank.
Hope that helps.
Chris Bradley wrote:
>
> I am trying to evaluate a string that contains a variable. For example:
>
> $lcuser = 'Frank';
> $x = "search.pl?user=$lcuser";
> print "x=" . $x;
>
> I want the output to be: x=search.pl?user=Frank
>
> I have tried using the eval($x) function, but it was returning a empty
> string.
>
> Any help is greatly appreciated, please reply to me privately and to the
> group.
>
> thanks
------------------------------
Date: Thu, 31 Jul 1997 06:42:20 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: file extensions
Message-Id: <smtpr5.ik.ln@localhost>
Shaun O'Shea (lmisosa@eei.ericsson.se) wrote:
: I have an array whose elements are all file paths E.G.
[snip data]
: I would like to use this array to create another array which just
: contains the file extensions i.e.
: .Uen.A.fmk
: .Uen.B.fmk
: .Uen.A.fmk
: .Uen.A.fmk
: I tried to find some way to substitute everything up as far as the first
: "." with nothing but I couldn't.
: Any offerings appreciated.
-------------------------
#!/usr/bin/perl -w
while (<DATA>) {
# push @exts, m!.*/[^.]*(.*)!; # all on one line
push @exts, m!.*/ # as much as you can get, up to the last slash
[^.]* # anything that is not a dot
(.*)!x; # all the rest is what we want
}
foreach (@exts) {print "$_\n"}
__DATA__
address/of/the/file/in/question/file1.Uen.A.fmk
address/of/the/file/in/question/file1.Uen.B.fmk
address/of/the/file/in/question/file2.Uen.A.fmk
address/of/the/file/in/question/file3.Uen.A.fmk
-------------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Thu, 31 Jul 1997 12:06:47 +0000
From: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: flocking files....
Message-Id: <33E07FD7.38B9@ptsc.slg.eds.com>
Tony Cox wrote:
>
> I'm struggling a bit with flocking files :-)
>
> The Camel book says that you perform a flock on a _file handle_
> obtained after a valid "open" command.
>
> Theoretically a return from flock of 0 (zero) is success and -1 is an
> error.
>
> If I flock a filehandle I get an unexpected return value of 1 (one) - this
> return value is not mentioned in the flock manpages.
I think the problem is that perl is returning:
val=(I32)(flock(fileno(fp), argtype)>=0);
which gives you 1 when flock returns 0 and 0 when flock returns -1
>
> If I flock on a filename (not file handle) I get a return value of 0
> (zero) - which is theoretically successful...but then it is not a
> filehandle I'm working with, so I don't know what worked....
>
> Can anyone shed any light on this...like an easy way to test if a file is
> locked?
>
> I'm using a Data General Aviion which implements its own flvor of flock
> called dg_flock....but the return codes are as stated above a(according to
> man pages).
>
> thanks
>
> *******************************************************************
> Dr. Tony Cox email: a.cox@rbgkew.org.uk
> Jodrell Laboratory http: www.rbgkew.org.uk
> Royal Botanic Gardens tel: (44)-181-332-5360
> Kew, U.K. fax: (44)-181-332-5310
> *******************************************************************
------------------------------
Date: Fri, 01 Aug 1997 00:21:04 +0200
From: "Balthasar T. Indermuehle" <bi@inside.ch>
Subject: Help: unlink arguments don't work??
Message-Id: <33E10FD0.8796B93D@inside.ch>
Hi,
I'm using unlink to delete some files.
If I use it like this it works:
unlink <lotsfiles*>;
If it's like this it won't work nor generate an error:
$lotsfiles = "names*";
@files = ($lotsfiles);
unlink @files;
or
$lotsfiles = "names*";
@files = (<$lotsfiles>);
unlink @files;
Please also respond via e-mail.
- Balt
--
+------------------------------------------------------------------+
| Balthasar T. Indermuehle, CEO INside Systems (Switzerland) GmbH |
| Gesellschaftsstrasse 73 |
| CH-3012 Bern |
| Switzerland |
| Phone: +41 (0)31 305 04 04 Fax: +41 (0)31 305 04 05 |
| Email: bi@inside.ch http://www.inside.ch |
+------------------------------------------------------------------+
------------------------------
Date: 01 Aug 1997 13:59:51 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
To: "Balthasar T. Indermuehle" <bi@inside.ch>
Subject: Re: Help: unlink arguments don't work??
Message-Id: <oee3eounp7c.fsf@alpha.hut.fi>
: If I use it like this it works:
:
: unlink <lotsfiles*>;
:
: If it's like this it won't work nor generate an error:
: $lotsfiles = "names*";
: @files = ($lotsfiles);
: unlink @files;
Why do you think this would work?
@files = ("names*") is not going to do any filename globbing.
: or
: $lotsfiles = "names*";
: @files = (<$lotsfiles>);
: unlink @files;
I think that if you read the below perlop snippet you will understand why
this does not work either.
> If the string inside the angle brackets is a reference to a scalar variable
> (e.g. <$foo>), then that variable contains the name of the filehandle to
> input from, or a reference to the same. For example:
> $fh = \*STDIN;
> $line = <$fh>;
> If the string inside angle brackets is not a filehandle or a scalar
> variable containing a filehandle name or reference, then it is interpreted
> as a filename pattern to be globbed, and either a list of filenames or the
> next filename in the list is returned, depending on context. One level of
> $ interpretation is done first, but you can't say <$foo> because that's an
> indirect filehandle as explained in the previous paragraph.
That is, you cannot do do globbing indirectly using the <>.
There is, however, a direct way:
> These days, it's considered
> cleaner to call the internal function directly as glob($foo), which is
> probably the right way to have done it in the first place.)
$lotsfiles = "names*";
@files = glob($lotsfiles);
glob is documented in perlfunc.
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: 1 Aug 1997 10:11:11 GMT
From: Andrzej =?US-ASCII?Q?Bagi=F1ski?= <abagi@idk.com.pl>
Subject: I'm looking for Perl, C, Python, JS, Java, etc. URL archive
Message-Id: <5rscnv$d98$1@korweta.task.gda.pl>
Hi
I had once this URL, byt now I can't find it.
I don't remember the name, but it was something like "scripts watch".
Anyone knows it?
Andrzej
--
_ _| __ \ | / | Andrzej Bagiqski | e-mail: abagi@idk.com.pl
| | | ' / | -----------------------------|-------------------------
| | | . \ | Netscape Nawigator i Komunikator po polsku dla platform
___|____/ _|\_\ | Unixowych. ---------- http://www.idk.com.pl/pl/netscape
------------------------------
Date: Thu, 31 Jul 1997 17:12:05 -0600
From: dschlot@george.arc.nasa.gov
Subject: Is it possible?
Message-Id: <870386933.12854@dejanews.com>
O.K. Perl guru's. Quick question.
Is it possible for a Perl script to take the input from an html form,
generate a new html document with the contents of the form, and then add a
link to the new document on another page? I went to a one day Perl class
and they had something similar but it was adding a link to the same page
the form was on instead of a different page.
Thanks!
Dave (Perl newbie)
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Fri, 01 Aug 1997 17:18:28 -0700
From: Kapil Raina <kraina@geocities.com>
To: Chris Ebert <luebert@ix.netcom.com>
Subject: Re: look at this
Message-Id: <33E27CD4.5BF8@geocities.com>
Not only is this a spam, but it is also illegal. The US Post
Office/Government has convicted people of such pyramid schemes under the
charge of mail fraud. Perhaps we should forward this list over to the
authorities....hmmm?
Chris Ebert wrote:
> =
> Some might call me skeptical but I will try this.
> =
> I was browsing through a newsgroup just like your are now and found a
> post similar to this one. I thought "This has to be a scam" but I was
> curious no the less. As I read on I began to get more interested. I
> didn=92t know if this was legal so I checked with the US postal service=
> and they said it was fully legal! So now I=92m trying this. And I know
> some people who have done this and made over $5,000.
> =
> THIS IS HOW YOU DO THIS
> 1. you get five envelopes, five stamps, five $1 bills, and five blank
> pieces of paper.
> 2. You write "Please put me on your mailing list" on each of the five
> pieces of paper. Then you fold the paper and put one dollar bill inside=
> of it so it can=92t be seen, to prevent thievery,. then you put the pap=
er,
> with the dollar bill inside of it, in the envelope and seal it.
> 3. Next address the five envelopes to the five address below and put a
> stamps on each of the envelopes. Now send them away.
> 4. Then copy this message and change it by taking #1 off the list and
> moving the other four up {4 becomes 5, 3 becomes 4 and so forth} then
> put your address as #5
> 5. Now post the new message {with your address as #5} on at least 2
> newsgroups, but remember the more newsgroups you post on the more money=
> you=92ll get.
> =
> HERE ARE THE ADDRESSESS
> =
> #1 M. Mafucci, 3 Hilltop Rd, Bronxville, NY 10708
> #2 Joyal Holder, 1980 N Snyder Dr., Richland Center, Wisconsin 53581
> #3 Evan Christensen 2746 Ome Ave, Dayton, OH 45414
> #4 Grahame Elton, 31A Hong Kong Street, Singapore 059 670
> #5 Chris Ebert, 6621 Imperial Ridge, El Paso, TX 79912
> =
> Now the why part:
> Out of 2 postings, say I receive only 5 replies (a very low example).
> So then I made $5.00 with my name at #5 on the letter. Now, each of th=
e
> =
> 5 persons who just sent me $1.00 make the minimum 2 postings, each
> with my name at #4, and only 5 persons respond to each of the original=
> 5. That=92s another $25.00 for me. Now those 25 each make 2 minimum
> postings with my name at #3 and only 5 reply to each. I will bring in
> an additional $125.00! Now, those 125 persons turn around and post the=
> minimum 2 with my name at #2 and only receive 5 replies each, I will
> make an additional $626.00! Okay, now here is the fun part. Each of
> those 625 persons post a minimum 2 letters with my name at #1 and they
> each only receive 5 replies. That just made me $3,125.00 with an
> original investment of only $5.00! AMAZING! And as I said, 5 response=
s
> =
> is actually very low!
> Average is probably 20 to 30! So let=92s put those figures at just 15
> responses per person. Here is what you will make:
> at #5 - $15.00
> at #4 - $225.00
> at #3 - $3,375.00
> at #2 - $50,625.00
> at #1 - $759,375.00
> When your name is no longer on the list, you just take the latest
> posting and start all over again. Be honest. If you don=92t come up wi=
th
> the measly $1.00 per person, people will know and you won=92t get much.=
> One guy did that and made only $150 in eight weeks. Keep track of who
> sends you money and watch the newsgroups for those names. GOOD LUCK!
------------------------------
Date: Fri, 1 Aug 1997 09:27:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Umm <l41484@alfa.ist.utl.pt>
Subject: Re: matching , in a reg expr
Message-Id: <Pine.GSO.3.96.970801092253.9029W-100000@kelly.teleport.com>
On 1 Aug 1997, Umm wrote:
> Subject: matching , in a reg expr
>
> I tried something like m/(*.),*$
I hope you tried something syntactically correct. :-)
> obviously i can't use , directly, i tried some variations but they don't
> work, can u help??
To match a comma in a regular expression, use a comma. :-) Commas aren't
special in regexps. Maybe this is what you want?
print "There's a comma\n" if /,/;
But in this case you might be better off using index.
print "There's a comma\n" if index($_, ',') != -1;
If you want to extract everything before a comma, or if you want to split
on commas, that can be done in similar ways. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 01 Aug 1997 11:53:02 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: "J.Hernetkoski" <jjjj@zenith.yok.utu.fi>
Subject: Re: Matching...
Message-Id: <33E1C00E.60C1E377@adc.metrica.co.uk>
J.Hernetkoski wrote:
> Hello again!
>
> I'd need to match all lines between <pre> and </pre>-tags
> and in the following code, $prices should include all text
> between <pre> and </pre>-tags.
>
> ($prices) = ($results = m#<PRE> ([^</PRE>]*)#i);
There are a couple of problems with the above. Firstly between
'$results' and 'm///' you should be using '=~' not '=', but assuming
that is a typo when you posted this it still wont work. [^</PRE>] - this
is defining a charater class where valid characters are anything except
the ones listed, it does not treat '</PRE>' as a single string but as a
list of characters. The regep you need is as follows:
($prices) = ($results = m#<PRE>(.*?)</PRE>#is);
This should work fine, note I have added the 's' option which makes it
treat the line as a single string which means that the '.' will cope
with the new lines.
Hope this is what you want, I recommend you read the perlop man page and
also see the FAQ as it is covered there as well.
Simon
------------------------------
Date: 1 Aug 1997 18:13:28 GMT
From: dalinka1@aol.com (Dalinka1)
Subject: NEWBIE HELP
Message-Id: <19970801181301.OAA27149@ladder02.news.aol.com>
Im a begining Perl Programer and Im having a couple of problems, begining
with WIN95 troubles. My perl interpriter is fine for UNIX style perl but
when I try to do anything like print to the end of multi line text its
clueless! Here is the line of code I typed in:
#!\usr\bin\perl -w
$input=<STDIN>;
chomp ($input);
print <<END_of_Multiline_Text
$input
END_of_Multiline_Text
EMAL ME THE ANSWER AT Dalinka1@aol.com
------------------------------
Date: Fri, 1 Aug 1997 07:33:52 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: newbie: Sorting a Flat File
Message-Id: <ebohlmanEE850H.3K8@netcom.com>
Ed Sherretta (ed@its2ez.com) wrote:
: PROBLEM:
: I don't want to keep going back and sorting this file every time I get a
: new entry. I would rather add this command to my script I am using to
: make new entries.
: QUESTION:
: Is there a way to simply add something like,
: sort -o directory.dat -t~ +2 -3 directory.dat;
: to my script?
: Or is it more complicated than that?
Yes, you can, but it's not the best way to do it (if you want to find out
how to invoke the sort from your script, read the entry for system() in
perlfunc).
Doing a full sort every time you add a new entry uses more server time
than you probably want to (and doing one on each query wastes even more
time, unless updates are more frequent than queries). Assuming the file
is already sorted (which you can do once before modifying your "add an
entry" script), it's a lot faster to simply go through the file, copying
each line to a temporary file, until you reach the point where the new
entry belongs and then write out the new entry to the temporary file and
copy the rest of the entries from the old file over. You then delete (or
rename) the original file and rename the temporary file to the original
file's name. You just have to make sure you can handle the cases where
the new entry belongs at the beginning or the end of the file.
"Add record to end of file and then sort" is a rather inefficient
brute-force technique. Oddly enough, if you have to do it, the fastest
sorting algorithm to use is a plain insertion sort, which is *not* one of
the fastest algorithms for the general case.
------------------------------
Date: Fri, 1 Aug 1997 09:44:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Arthur Sauer <arthur@sauer.demon.nl>
Subject: Re: Newbie: Why won't help work on my mac?
Message-Id: <Pine.GSO.3.96.970801094129.9029a-100000@kelly.teleport.com>
On Fri, 1 Aug 1997, Arthur Sauer wrote:
> I've just started with PERL and cliked on the help menu. The warning
> "Could not find helper pod. Do you want to create one? For "file" you
> should specify a WWWbrowser as helper. Launch internet config" appears.
> In internet config I specified Netscape 3.0 Gold as helper for file (and
> saved the settings). Still this warning keeps appearing. Why wont it
> work?
This should be covered in the docs which come with MacPerl. You need to
choose a helper for POD files. In Internet Config, add a helper for "pod"
(no quotes) and choose the helper "Shuck". The (really cool) Shuck
application comes with recent MacPerl distributions. If you have more
questions about Internet Config, feel free to send me private e-mail about
it. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 1 Aug 1997 09:49:50 GMT
From: dregis@exeter.ac.uk (David Regis)
Subject: Nobbling "Sender" field in rn?
Message-Id: <EE8BB2.Aw6@exeter.ac.uk>
I use "rn" to read news, but inevitably every post I make attracts
junk e-mails (including, I expect, this one).
I see clever people who can nobble the sender fields on their posts to
read something like
D.Regis"at"exeter.ac.uk
or
N.O.Junk@D.Regis.exeter.ac.uk
I can type D.Regis"at"exeter.ac.uk into the sender field but it gets
overwritten somewhere down the system.
Now while the rn man pages are full and fine I don't recognise how to
nobble this using rn. My sysadmins aren't that interested in rn (or
mail filters) and so I wondered if anyone reading this newsgroup had a
hack for it.
P.S. I also have access to a reader called "pent".
Thanks
--
Dave Regis &8^D* | _ | (D.Regis@exeter.ac.uk)
SCHOOLS HEALTH EDUCATION UNIT | / "()/~ |
Exeter University School of Education | || \_/| | "The truth is rarely pure
Heavitree Road EXETER Devon EX1 2LU | ~\ / | and never simple"
http://www.ex.ac.uk/~dregis/sheu.html | _|||__ | -- WILDE
------------------------------
Date: Fri, 1 Aug 1997 07:08:53 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: jsbobcat@erols.com
Subject: Re: NT Perl Sources and problem
Message-Id: <Pine.GSO.3.96.970801065903.9029I-100000@kelly.teleport.com>
On Wed, 30 Jul 1997 jsbobcat@erols.com wrote:
> I am running Perl 5.0? on NT server. If I go to the command level and
> type: test.pl &term=testing&ok=yes
That command might not work, depending upon how your command-line
interpreter does things. (On a Unix-type system, you would have to quote
that string to make it a parameter, but I don't know about NT. If you
can't find that information in your NT docs, a NT-specific newsgroup
should be able to help.)
> for example. My test.pl does not work. I have tried
> $buffer = "";
> foreach $test (@ARGV) {$buffer = $buffer.$test;}
>
> Buffer never get's load. @ARGCV is empty.
Do you mean @ARGCV or @ARGV? (That's probably a typo.)
Just for debugging, try putting something like this near the top of
your script, so that you can see exactly what's in @ARGV.
print
"ARGV contains:\n",
map(" $_: '$ARGV[$_]'\n", 0..$#ARGV),
"###\n\n";
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>
> read does not read stdin because $buffer is still not getting loaded.
Is this $buffer the same one as before, or have you accidentally re-used a
variable name. This should do what you ask of it, though, whether $buffer
is initialized or not. Do you know what the value of CONTENT_LENGTH is? If
read() returns undef, do you know what the value of the magical $!
variable is?
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 1 Aug 1997 16:28:19 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: OLE with Perl
Message-Id: <01bc9e98$4c22d4e0$ca75e7c8@AFXTD_202.Autofax>
Hi ! I try to do a Perl test with Ole, but Perl tell me :
C:\DOWN\Testes>perl test-ole.pl
Undefined subroutine &Win32::OLECreateObject called at C:\PERL\LIB/OLE.pm
line 103.
I installed libwin32 yet. then What's wrong ?
Thanks for any help
--
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@mail.serve.com
--------------------------------------------
------------------------------
Date: Fri, 01 Aug 1997 09:10:16 -0400
From: Joe Kline <Joe.Kline@sdrc.com>
Subject: Re: Print Web Page a la netscape
Message-Id: <33E1E038.1CFB@sdrc.com>
I would just like to thank Tom Phoenix, Clark Dorman, and
Cameron Simpson for their help.
I got a lot of good suggestions, but it looks like the
quickest and easiest would be doing some stuff with netscape
from the command line.
I might look into the whole rendering thing, but that seems to be
a bit much for me right now.
Thanks,
joe
--
Joe.Kline@sdrc.com
------------------------------
Date: Fri, 1 Aug 1997 10:00:32 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: printing
Message-Id: <ebohlmanEE8Bsw.Dp1@netcom.com>
Devin Anderson (dev@sgi.net) wrote:
: I'm trying to print output from a cgi script. The problem is that when
: someone types in text in a textarea, there are no newlines so the
: printer just runs the line off the side of the page.
: What is the best way to format the text so that it won't run off the
: page? Use a regular expression to place a newline/carrige return every
: 79 character? I tried to pipe the output thorugh 'pr', but I can't get
: the pr to format it correctly.
Text::Wrap is your friend.
------------------------------
Date: 1 Aug 1997 17:38:53 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Problems with tie/DB_File/references
Message-Id: <5rt6vd$rn2$3@neocad.com>
robert (robert@ICK.il.fontys.nl) wrote:
: So my question is...what am I doing wrong?? :) Thanks alot in advance.
Using a broken newsreader? That return address bounces to me, so
much for trying to be courteous and responding via e-mail.
Your code works fine on my system. What does your perl -V look
like? What system, OS, Arch, etc are you using?
Jeff
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: Fri, 01 Aug 1997 12:16:38 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: mystery@itis.com
Subject: Re: Questions regarding speed of grep EXPR
Message-Id: <33E1C596.C1B82CAC@adc.metrica.co.uk>
Prince Mystery wrote:
> Ok, time trails are here: Whats the fastest routine
>
> foreach (@keys) {
> $counter++ if(/searchString/);
> }
>
> $counter = $#{ grep {/searchString/} @keys } + 1;
>
> Both clock under a second on a 1MB hash brought out of a dbm file, and
> I
> don't have anything bigger to work on.
>
> Thoughts?
>
> Myst
>
> -------------------==== Posted via Deja News
> ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
IMBECILE ( me not you that is )
Ignore the last post, I had a quick rethink and realised I should have
looked at the code a bit more closely, correction follows:
File:
use Benchmark;
my @array = ( qw( The Benchmark module encapsulates a number of routines
to help you figure out how long it takes to execute some code) );
timethese(shift, {
'using foreach' => 'foreach(@array){$counter++ if /on/}',
'using grep' => '$counter = grep /on/, @array;',
});
This gives ( same as before if you need to reset $counter ):
>perl foreachVgrep 100000
Benchmark: timing 100000 iterations of using foreach, using grep...
using foreach: 1 secs ( 1.40 usr 0.01 sys = 1.41 cpu)
using grep: 1 secs ( 1.02 usr 0.01 sys = 1.03 cpu)
Sorry.
Simon
------------------------------
Date: Sat, 2 Aug 1997 00:20:25 +0200
From: uzs90z@uni-bonn.de (Michael Schuerig)
Subject: Re: Regexp for postal address?
Message-Id: <19970802002025199953@rhrz-isdn3-p20.rhrz.uni-bonn.de>
Tom Phoenix <rootbeer@teleport.com> wrote:
> And I didn't make any attempt to match four-line addresses, or to ensure
> that a non-address doesn't match. But, as I said, maybe it's a start. Hope
> this helps!
Great! Many thanks for your effort.
Michael
--
Michael Schuerig I am the sum total of the
mailto:uzs90z@uni-bonn.de parts I control directly.
http://www.uni-bonn.de/~uzs90z/ -Daniel C. Dennett
------------------------------
Date: 01 Aug 1997 17:16:27 -0400
From: tim@hcirisc.cs.binghamton.edu (Tim Gray)
Subject: sprintf padding question
Message-Id: <t0iuxpppsk.fsf@hcirisc.cs.binghamton.edu>
How can I pad a float on both ends with zeroes?
I have numbers like 123.55 and I want them to be printed like
000123.5500
I tried sprintf "%6.4f", 123.55 but that didn't work. Will I have to
do a split on the period and pad each part separately?
------------------------------
Date: 1 Aug 1997 15:57:10 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: Stripping ^M from a variable. How?
Message-Id: <slrn5u41qm.jnm.I-hate-cyber-promo@news.rediris.es>
In <33E1EBF8.11A9E708@absyss.fr>,
Doug Seay <seay@absyss.fr> wrote:
[...]
>#!/usr/local/bin/perl -w
>
>use strict;
>use IO::File;
>
>undef $/;
>
>foreach my $file ( @ARGV )
> {
> my $fh = IO::File->new("<$file");
> my $data = <$fh>;
> $data =~ s/\cM//g;
> $fh->open(">$file"); # reopen for writting
> $fh->print($data);
> $fh->close();
> }
Any reason why the following won't do?
perl -pi.bak -e 's/\cM//g;' file1 file2 ...
ALain
--
Perl information: <URL:http://www.perl.com/perl/>
Perl archive: <URL:http://www.perl.com/CPAN/>
Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<
------------------------------
Date: 1 Aug 1997 09:45:48 GMT
From: etltsln@etlxd30.ericsson.se ( Thomas Lachlan XMS x4206 )
Subject: Sum v Perl
Message-Id: <5rsb8c$53s@newstoo.ericsson.se>
Hello,
I have written a little program around the unpack example
in the perlfunc manpage. It's mission is to return the
16 bit checksum that the system V sum program delivers.
In this instance it is the /usr/5bin/sum program inherent
of SunOS 4.1. The program seems to work well, however with
some large files there is a discrepency between
the values output. For example..
Ther Perl prog may give 62808 and the
Sum prog may give 62815. Hence the difference
is minimal however somewhat annoying. I am unable to track
down the sum source and thus am at a loss as far as running
it under a debugger ('gdb' etc..) I would be most grateful
if somebody could suggest possible causes of this phenomena.
N.b. the size of the binary does not seem to matter, for the
perl prog is bang on with SunOS vmunix kernels.
The guts of the program are as follows:
open(FILE,"<$file") || die "$!\n";
$line='';
$checksum=0;
$num_times_reg_full=0;
while(sysread FILE, $line,512)
{
$checksum += unpack("%16C*",$line);
}
$num_times_reg_full=$checksum / 65535;
$checksum += $num_times_reg_full;
$checksum %= 65536;
close(FILE);
Thankyou for your time.
Regards Tom
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 806
*************************************