[8344] in Perl-Users-Digest
Perl-Users Digest, Issue: 1961 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 23 22:08:13 1998
Date: Mon, 23 Feb 98 19:00:32 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 23 Feb 1998 Volume: 8 Number: 1961
Today's topics:
Re: Apache server not recognising perl scripts in cgi-b <moises@texas.net>
Re: Beginner in trouble (Martien Verbruggen)
Re: Cookies (Mark J. Gardner)
Re: Cookies (Andrew M. Langmead)
factorial function? <paulo@xilinx.com>
Re: Getting started with CGI/Perl <medined@planet.net>
Re: Hangs with sendmail ... <ke4krt@radio.org>
Re: Help! CGI Registry Editing (Martien Verbruggen)
Re: Help: Warning in string to number conversion. uri@sysarch.com
Re: I really need your help. (Jonathan Feinberg)
Re: Installation Of PERL (Martien Verbruggen)
Re: IP-Address in Perlscripts (Martien Verbruggen)
Re: KERMIT (Clay Irving)
Re: Law-enforcement apps ? (Martien Verbruggen)
Re: Mail Attachments via Perl Sendmail A REAL ANSWER! (Martien Verbruggen)
Need some advice <pyefinch@b130.aone.net.au>
Re: Newbie Question about Perl and Server Side Includes <moises@texas.net>
Re: Off-topic (Sorry, but I need your help) (Bart Lateur)
Re: Off-topic (Sorry, but I need your help) (Martien Verbruggen)
Overwriting a entry in a file. <vallery@bvsd.k12.co.us>
Re: Overwriting a entry in a file. <cdkaiser@delete.these.four.words.concentric.net>
Re: Q: scalar @{[/$f/g]} (Bart Lateur)
read char without echo <HaraldWolf@swol.de>
Re: read char without echo <tchrist@mox.perl.com>
Re: regexp problem (Bart Lateur)
rejecting MIME mail (was Re: Killfile Triage) <Russell_Schulz@locutus.ofB.ORG>
Re: Send email from Perl on NT platform (Martien Verbruggen)
Re: Sorting that Hash on non-key field (part way there) <jstern@world.northgrum.com>
Re: The Ineffable Tom C. <Joergen.Lang@no-spam.de>
Re: why no Case statment? (Andrew M. Langmead)
Re: why no Case statment? (Martien Verbruggen)
Re: why no Case statment? uri@sysarch.com
Re: Why not RegEx in $/? (Ilya Zakharevich)
Re: Why not RegEx in $/? (Bart Lateur)
Re: Why not RegEx in $/? uri@sysarch.com
Re: Why PERL? [Re: Beginner in trouble] (Jim Michael)
Re: Why PERL? [Re: Beginner in trouble] (Jeff Yoak)
Re: Why PERL? [Re: Beginner in trouble] uri@sysarch.com
Re: y2k UNIX laundry list <swd@strata-group.Xcom>
Re: y2k UNIX laundry list <tchrist@mox.perl.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Feb 1998 18:56:56 +0000
From: "Moises G. Solis" <moises@texas.net>
Subject: Re: Apache server not recognising perl scripts in cgi-bin
Message-Id: <34F1C678.1904BFF3@texas.net>
Have you been able to execute perl scripts from your server before now?
Have you checked for execute permissions?
If this is the first time, look at http://www.apache.org web site for
documentation.
There at least a hundred things that can go wrong. Good luck!
Moises.
Gilles Chong wrote:
> Hi,
> im getting some kinda hair-pulling prob here.
> My apache server is not recognising my perl script as an 'executable',
> i.e not running it. The browser merely display the perl script code (i.e
> like any other text file).
> Ive checked the config files for apache, all the cgi-bin dir references
> are correct. Ive restarted the server many times. My perl compiler
> (perl5.003) is working perfectly as well. I am guessing that the problem
> comes from the server.
> Any of u guys n gals came across tt prob before?
> Any suggestions, pls email me directly.
> Cheers
>
> G.
> --
> Gilles Chong (glchy@csah.com, glchy@csa.com.sg)
> Systems Engineer, Internet Division
> CSA Holdings Ltd, Singapore.
------------------------------
Date: 23 Feb 1998 22:03:31 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Beginner in trouble
Message-Id: <6csrnj$4l5$3@comdyn.comdyn.com.au>
In article <34F1444F.24231F55@posta.unizar.es>,
Alberto Turon Lanuza <alberto.turon@posta.unizar.es> writes:
> My script has to read several files and match two strings, returning the
> number of lines that contain both strings. Why doesn4t the following
> code run?
How doesn't it run? perl exits with an error message? It does run, but
doesn't produce the results you expect?
Did you run it with the -w flag?
#!/usr/local/bin/perl -w
(you really should get into the habit of programming with 'use strict'
as well)
> foreach $domain (@domains) {
>
> $machine=0;
>
> opendir(DIR,"../../logs");
You don't check the return value of this opendir. How do you know that
it succeeded?
> @files = readdir(DIR);
You do realise you have '.' and '..' in here as well?
Have you checked what @files contains here? (simple print, or in the
debugger)
> closedir(DIR);
>
> foreach $fich (@files)
> {
> if (($fich ge $inifile) && ($fich le $endfile))
> {
Have you checked what $inifile and $endfile are here, and if this
statement ever evaluates to a true value?
> $fich='../../logs/'.$fich;
>
> $machine += `egrep -c "$domain.*\/html\/machine" $fich`;
Just pedantic here: You are using an external program, but you can do
this in perl internally. Also, you're using egrep for a task that can
be performed faster by fgrep.
> I know there are beter ways to do it, but remember I am a beginner. Now
> I just need it to run.
I can't see anything obviously wrong with the code. If you could be
more specific about what exactly goes wrong, maybe we can be of more
help.
Also: the things I said above are meant as constructive criticism. If
you get into the habit of programming perl with the -w flag on, and
always with a use strict, you'll find that your debug cycles get a lot
shorter.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: Tue, 24 Feb 1998 01:16:36 GMT
From: mjg@merck.com (Mark J. Gardner)
Subject: Re: Cookies
Message-Id: <34f21ec0.262987716@merck.com>
On Sun, 22 Feb 1998 11:04:30 -0500, jdf@pobox.com (Jonathan Feinberg)
wrote:
[question about cookies that doesn't really belong in c.l.p.m deleted]
>Dutchie, mon, you need to use CGI.pm, which comes with excellent
>documentation. It provides the 'cookie' method, which makes trivial the
>leaving and retrieving of cookies. If you have perl5.004, then you've already
>got CGI.pm. If not, you should get perl5.004. Hope this helps.
Careful, your platform is showing....
CGI.pm only comes with the Win32 port of Perl, and then only Gurusamy
Sarathy's port.
All the rest of us have to get it from CPAN.
...MJG
Mark J. Gardner * mjg@merck.com
The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.
------------------------------
Date: Tue, 24 Feb 1998 02:52:32 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Cookies
Message-Id: <Eov3zK.Gpx@world.std.com>
mjg@merck.com (Mark J. Gardner) writes:
>Careful, your platform is showing....
>CGI.pm only comes with the Win32 port of Perl, and then only Gurusamy
>Sarathy's port.
The CGI modules are included in the standard distribution starting
with version 5.004.
Notice these files in the distribution:
$ tar tzf /usr/src/perl5.004.tar.gz |grep CGI
perl5.004/lib/CGI.pm
perl5.004/lib/CGI/Apache.pm
perl5.004/lib/CGI/Carp.pm
perl5.004/lib/CGI/Fast.pm
perl5.004/lib/CGI/Push.pm
perl5.004/lib/CGI/Switch.pm
and notice these section of the man page:
INSTALLATION
CGI is a part of the base Perl installation. However, you
may need to install a newer version someday. Therefore:
I personally feel it was a poor choice, but apparently the decision
has been made. "CGI.pm" is now as much of a part of perl as <string.h>
is a part of C.
--
Andrew Langmead
------------------------------
Date: Mon, 23 Feb 1998 13:47:18 -0800
From: Paulo Dutra <paulo@xilinx.com>
Subject: factorial function?
Message-Id: <34F1EE66.86C2EEF@xilinx.com>
Is there a recommended library to handle factorial implementations?
--
Paulo //\\\\
| ~ ~ |
( O O )
__________________________________oOOo______( )_____oOOo_______
| . |
| / 7\'7 Paulo Dutra (paulo@xilinx.com) |
| \ \ ` Xilinx hotline@xilinx.com |
| / / 2100 Logic Drive (800) 255-7778 |
| \_\/.\ San Jose, California 95124-3450 USA (408) 879-6797 |
| Oooo |
|________________________________________oooO______( )_________|
( ) ) /
\ ( (_/
\_)
------------------------------
Date: Mon, 23 Feb 1998 21:20:59 -0500
From: David Medinets <medined@planet.net>
Subject: Re: Getting started with CGI/Perl
Message-Id: <34F22E8B.FEC2553B@planet.net>
Martien Verbruggen wrote:
> In article <6cqc2r$cqv@newsops.execpc.com>,
> "Thad Rolling" <thad@execpc.com> writes:
>
> > Since I am new to Perl and CGI and Apache (but not HTML), I was wondering if
> > anyone has a checkoff list of things needed to run Perl CGI programs. A
> > simple working example would be great too!
Try http://www.affy.com/p5be
That's an online version of "Perl 5 by Example". It has several examples
of CGI programs.
david
------------------------------
Date: Mon, 23 Feb 1998 18:16:24 -0500
From: Phil Heaton <ke4krt@radio.org>
Subject: Re: Hangs with sendmail ...
Message-Id: <34F20348.79E0F5E9@radio.org>
Try this:
$MAILMAN="/your/path/to/sendmail -t" ;
open(POSTAL, "|$MAILMAN") || die "Failed at open POSTAL!" ;
print POSTAL "To: $user\n" ;
print POSTAL "Bcc: $whoever\n" ;
print POSTAL "Subject: Howdy\n" ;
print POSTAL "Reply-To: $someone\n" ;
print POSTAL "\n\n" ;
print POSTAL "$body_of_message\n\n" ;
close(POSTAL) ;
Phil
--
Phil Heaton
ke4krt@radio.org
http://www.qsl.net/ke4krt
------------------------------
Date: 23 Feb 1998 23:36:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help! CGI Registry Editing
Message-Id: <6ct16h$578$1@comdyn.comdyn.com.au>
In article <34F19DE1.797B@acceltec.com>,
"John C. Marsella" <sales@acceltec.com> writes:
> Solution Needed!!
>
> I need to know if it is possible to run a compiled
> c program (or perl, java, javascript, any web related programming
> language!) on a unix machine during a web session
> that can use an environment variable(s) to enter the user's registry and
> read keys and values...?
Ok, apart from the remote possibility that that program could be a
perl script, what does this have to do with perl?
c and perl are NOT web related at all. Neither is java, really.
> I once visited a site that could tell what type of machine
> I was using, what type of modem, how much RAM I had and other such
> things.
It shouldn't. Maybe it was some ActiveX thingie, running on some MSIE
browser? Anyway, nothing to do with perl.
> I have used the standard CGI %ENV variables to the limit and those
> will not perform the magic I need...
You cannot do what you want through CGI. You should be asking
questions like this on a web related news group. Go to one of the
comp.infosystems.www.* groups, and ask there. You have much more
chance on success that way. You also really should read up on CGI,
> If you can help you will be compensated financially as well
> as receive great credit through the use of banner ads!
naw, not necessary.
> E-Mail a solution to john@acceltec.com
nope. Post here, read here.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: 23 Feb 1998 21:51:59 -0500
From: uri@sysarch.com
Subject: Re: Help: Warning in string to number conversion.
Message-Id: <x7iuq53eb4.fsf@sysarch.com>
Chipmunk <rjk@coos.dartmouth.edu> writes:
> > In article <34F0A25E.1A97B5E@coos.dartmouth.edu> you write:
> >
> > >On the other hand, I think the only way a string will convert to 1 is if it
> > >matches this regex:
> > >
> > >/^\+?0*1(?:\.0*(?:\D|$)|[^\d.]|$)/
> > >
> > >(But there are probably cases I've missed in constructing it. I had to
> > >discard away several simpler versions.)
> >
> > ' 1' =~ /^\+?0*1(?:\.0*(?:\D|$)|[^\d.]|$)/
> > '1e1' =~ /^\+?0*1(?:\.0*(?:\D|$)|[^\d.]|$)/
> Or, with a single regex:
>
> (/^\s*\+?0*(?:(.0*)?1e(\d+)|1(?:\.0*(?:\D|$)|[^\d.]|$))/
> and ((not defined $2) or (length($1) == $2)))
why not use this (randal schwartz invented it a long time ago) which
will match any legal number. then just compare to 1. you can handle
white space by trimming the string or adding \s* to this regex.
/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/
this was my version which works as well but was not as concise. somehow
the warped mind of randal used the lookahead (which i hadn't known or
thought much about at the time) to remove the need for the extra clauses.
( /^[+-]?(\d+)?(\.)?(\d+)?([eE][+-]?\d+)?$/ &&
($1 ne '' || $3 ne '') && ($2 || $4 ) )
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: Mon, 23 Feb 1998 20:23:27 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: I really need your help.
Message-Id: <MPG.f5beb1c7b1eea98973f@news.concentric.net>
[courtesy cc of this posting sent to cited author via email]
seong@cse.bridgeport.edu said...
: My sub routine will search all of the html files within /home/bunny
: directory that has the names of users.
: After certain numbers of users, the output says "can't open /home/bunny/
: username". I should be able to open them.
: I don't really know what's wrong with my sub routine. Please help me.
I started to write a detailed autopsy of your code, when I suddenly realized
that you're reinventing the unix command "find". If you have a Unix box, you
may simply run
find /home/bunny -name '*.html'
Or (even on a Win32 box) you may create a perl program that does the same
thing by typing
find2perl /home/bunny -name '*.html' -print > find_html
chmod 755 find_html
./find_html
To learn more, do "man find" at your prompt.
--
#!/usr/bin/perl -w -- Just another Perl hacker,
(open 0),$_=<0>,s,.*- +,,,chop;for(split?@*?){($$_++or$}=$_,y,y \,\
y,<STDIN>,,$$=~s\^\"sub $_ {print'$}'};7"\ee),y,} \,},>STDOUT,,&$_}
# Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 23 Feb 1998 22:05:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Installation Of PERL
Message-Id: <6csrs1$4l5$4@comdyn.comdyn.com.au>
In article <6crkc2$csr$1@nnrp2.dejanews.com>,
shilpa@ril.com writes:
> We have our web server running on linux2.0.0.
> While installing PERL we are getting this error
> make: ***[miniperlmain.o] Error 1.
This surely isn't the only error. This is the error that make
generates. There should be more than this.
> We are removing some flags & libraries as we don't want it.
How do you do that? By manually editing the Makefile? You shouldn't be
doing that.
> We can successfully run sh Cofigure, after that
> we do the next step "make", while doing this we get the
> above error. Is it because of cc complier or what?
Without more information, it's hard to say.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd. | thing but mean your mother.
NSW, Australia |
------------------------------
Date: 23 Feb 1998 22:09:22 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: IP-Address in Perlscripts
Message-Id: <6css2i$4l5$5@comdyn.comdyn.com.au>
In article <6crlec$dtm$1@nnrp2.dejanews.com>,
100.191995@germanynet.de writes:
> If a Perlscript is called on a WWW-Server, is there any way to get the
> IP-Address of the caller?
This has nothing to do with perl. This is most likely a CGI question.
In perl you just refer to the same environment variables as you would
in any language. It's specified in the CGI specs.
You should ask this on a CGI group, and read the CGI specification.
comp.infosystems.www.authoring.cgi
http://www.webthing.com/page.cgi/cgifaq
http://www.perl.com/perl/faq/idiots-guide.html
http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
> If there are any ideas please send me an eMail to: 100.191995@germanynet.de.
Post here, read here.
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing down
Webmaster www.tradingpost.com.au | all the noises the baby makes so later
Commercial Dynamics Pty. Ltd. | I can ask him what he meant - Steven
NSW, Australia | Wright
------------------------------
Date: 23 Feb 1998 21:35:10 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: KERMIT
Message-Id: <6ctbku$jpe@panix.com>
In <gerlachEop208.M3p@netcom.com> gerlach@netcom.com (Matthew H. Gerlach) writes:
>I have UNIX perl scripts that access the serial port by "talking" to the
>ckermit program. On can control the ckermit program to tell it to
>transfer files using the kermit protocol or any external protocol you
>choose (e.g. X or Z modem). Check the following for some of my example
>code:
>ftp://www.smallplanetbrewery.com/users/coralie/perl_serial_example
ftp://www.smallplanetbrewery.com/users/coralie/public/perl_serial_example
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: 23 Feb 1998 21:42:51 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Law-enforcement apps ?
Message-Id: <6csqgr$4l5$1@comdyn.comdyn.com.au>
In article <34F1168D.13B405C1@sympatico.ca>,
"John W. Austin" <jwaustin@sympatico.ca> writes:
> I am currently wrapping-up a project in law-enforcement and am filling
> in a missing link
> with some perl code (on OS/2) instead of writing a much larger C++
> program. I am
For your next post, you should also wrap your lines :) It makes the
message a lot more readable.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: 23 Feb 1998 21:53:47 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Mail Attachments via Perl Sendmail A REAL ANSWER!
Message-Id: <6csr5b$4l5$2@comdyn.comdyn.com.au>
In article <34F13F48.78824BFE@kiwi.net>,
Craig <rcd@kiwi.net> writes:
> This is a multi-part message in MIME format.
> --------------E643362859EF6F2A214915BE
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
Please, please don't do this. Usenet is a plain text medium, don't
post multipart MIME messages.
>
> Recently I asked the NG if anyone knew how to send attachments with Perl's
> sendmail. It was tough finding an answer that didn't require the MIME::Lite
I don't understand this. Why don't you want to use a perfectly fine
module? And if you have a problem with MIME::Lite specifically, why
not use a combination of some of the other modules, if you know what
you're doing.
> --------------E643362859EF6F2A214915BE
> Content-Type: application/x-perl; name="attach.pl"
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline; filename="attach.pl"
Grrr
> #!/usr/bin/perl
[Snip this code]
I'll tell you why I think people should not be using your code, but
instead should use MIME::Lite.
Your code
- doesn't have the -w flag
- doesn't use strict
- uses external system dependent programs
- doesn't do enough error checking
- is too specific
- reinvents the wheel in several places
- doesn't use an external mime.types file. You have to actually change
the code to add types
- doesn't check the return values of open() (twice)
- uses binmode, even though the program is specifically written for
unix, and will not run anywhere else
- doesn't use a here document syntax. Makes it hard to maintain that
whole cascade of prints
- assumes that it's a CGI application, but doesn't use CGI.pm
- outputs invalid html
I really hope people will not use your code, but instead will use the
much better tools they can get from CPAN.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: Tue, 24 Feb 1998 11:45:15 +1000
From: "Brad Grove" <pyefinch@b130.aone.net.au>
Subject: Need some advice
Message-Id: <6ct8v0$r52$1@news.mel.aone.net.au>
Hi all
I am reasonably new to PERL and have managed to develop some rather useful
scripts for our company web site. We do not have our own server, but use an
ISP (virtiual server) which probably makes things a little more difficult
when debugging.
My problem is this:
I have developed a bulk emailing script which will read our web database and
email each of our customers in the database. For each record in the
database, it simply checks for a valid email address etc and passes the data
with the results of the form (passed from a browser) to the ISP's mail
program. It seems to work well except it does not send any response back to
the browser until the script has completed. If the email list is long, then
the browser times out and seems to end the script without me knowing just
what was sent.
Is there a way of controlling server processes whereby the server can pass
back an acknowledgement to the browser and continue on it's mary way
processing the emial. At least then the browser wouldn't just sit there
after pressing the submit button on the form until it times out with an
error message. The last emial address in the database could simply be a
confirmation of the completed task which is sent to me.
Anybody got any ideas?
Regards
Brad Grove.
------------------------------
Date: Mon, 23 Feb 1998 19:14:58 +0000
From: "Moises G. Solis" <moises@texas.net>
Subject: Re: Newbie Question about Perl and Server Side Includes
Message-Id: <34F1CAB2.55DF8DEF@texas.net>
Since you including another html file, that might be causing your problem.
Usually, you include a text file. Remember that the HTML file contains
<HTML>...<BODY> tags. They will be repeated.
I don't know if PWS will support what you are trying to do without being
connected to the Internet. I do know that Peer Web Server with NT works. I
also know that SSIs work with NT and IIS.
You html file with the SSI must have an STM extension. You files directory
must be executable. Your registry must be configured properly. You may also
have to install ASP support. That $ way!
For an example of SSI/NT/IIS/Perl, visit http://www.GodsDailyWord.com/
Normally, this is not the news group for these types of questions.
Moises.
Phil Anderson wrote:
> I am new to programming PERL and am having problems getting a Server Side
> Include to function correctly.
>
> My PERL script generates all the HTML and sends it to the browser, but the
> server doesn't seem to recognize the <!--#include file="x.html"--> tag. By
> that I mean it doesn't do the include, I see the tag as a comment in the
> HTML source.
>
> I'm running PersonalWebServer Win95 with PERL version 5.003_07.
>
> Thanks in advance
> --------------------
> Phil Anderson
> AMC Theatres
> EMail: PAnderson@AMCTheatres.com
------------------------------
Date: Mon, 23 Feb 1998 22:47:58 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Off-topic (Sorry, but I need your help)
Message-Id: <34f9f403.2486949@news.tornado.be>
"Paul Makepeace" <Paul.Makepeace@POBox.com> wrote:
>Rumours I've heard, http://www.microsoft.com/ does run on Unix :-)
Can't be. Unix isn't that terrible.
Have you ever visited their site? I go there regularily. And I've NEVER
had a visit where something didn't go wrong. Note that this purposely
was a double negation. In other words: there's always been something
that screwed up.
Bart.
------------------------------
Date: 24 Feb 1998 00:11:24 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Off-topic (Sorry, but I need your help)
Message-Id: <6ct37c$5f3$2@comdyn.comdyn.com.au>
In article <6crj4t$ppa$1@rockcake.bt.net>,
"Paul Makepeace" <Paul.Makepeace@POBox.com> writes:
> Rumours I've heard, http://www.microsoft.com/ does run on Unix :-)
I think they only run some unix stuff in front of their web servers,
to protect the NT boxes from baddies on the net. Of course, NT can't
handle any baddies.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Mon, 23 Feb 1998 16:05:17 -0700
From: Jason Vallery <vallery@bvsd.k12.co.us>
Subject: Overwriting a entry in a file.
Message-Id: <Pine.GSO.3.96.980223160311.4031A-100000@bvsd.k12.co.us>
I have opened a file and I am appending to it.
My problem is that there is a chance a "similar" line will be ther.
For example. I might have a line in the file something like this.
10:Hours:23
and I want to update that line to look like this.
10:Hours:12
But I don't want to dystroy any of the data above and below.
can anyone help please?
_____________________________________________
/ __________ Jason Ray Vallery \
| | ___)_ |
| | _____) vallery@bvsd.k12.co.us |
| | ______) guide4@bvsd.k12.co.us |
| | _______) vallery@usa.net |
| \_______) vallery_j@gems.colorado.edu |
\_____________________________________________/
------------------------------
Date: 24 Feb 1998 00:47:56 GMT
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: Overwriting a entry in a file.
Message-Id: <6ct5bs$ar3@examiner.concentric.net>
Jason Vallery <vallery@bvsd.k12.co.us> writes:
>I have opened a file and I am appending to it.
>My problem is that there is a chance a "similar" line will be ther.
>For example. I might have a line in the file something like this.
>10:Hours:23
>and I want to update that line to look like this.
>10:Hours:12
I don't understand what you mean. If you're appending, then you shouldn't
be modifying anything in-place, right?
Anyway, what's the criterion for whether you want to change a line or not?
Is it the presence of the ":Hours:" string? What's the correlation between
23 and 12? A little more information please. :-)
--
Cameron Kaiser
cdkaiser at concentric dot net (it hasn't helped the spam yet though)
*** visit the Spectre Server at www.sserv.com
*** C64 software lives! www.computerworkshops.home.ml.org
------------------------------
Date: Mon, 23 Feb 1998 22:47:53 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Q: scalar @{[/$f/g]}
Message-Id: <34f8f3de.2450039@news.tornado.be>
mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:
>>$e=()=/$foo/g;
>It was an entirely deliberate bug fix, and not a side effect of any other
>change. Versions of Perl before 5.004 had a bug that the empty list
>was not acceptable as the LHS of an assignment, if it was written as ().
(ex.)
>$e=(undef)=/$foo/g;
>All rather clumsier than Andrew's version.
So assignment to () only serves to create a temporary list context.
Wouldn't it be time to dump this hack in favour of a "real" solution, a
new Perl keyword, the opposite of scalar?
ex.
$e = array /$foo/g;
This is from the POD, item "scalar":
>There is no equivalent operator to force an expression to
>be interpolated in a list context because it's in practice never
>needed.
Yeah, right.
So this mysterious looking clever hack only serves to solve a problem
that doesn't even exit.
Bart.
------------------------------
Date: Mon, 23 Feb 1998 21:30:50 +0100
From: Harald Wolf <HaraldWolf@swol.de>
Subject: read char without echo
Message-Id: <34F1DC79.2DE8357A@swol.de>
Hi,
exists a function which reads one single character from keyboard without
echo ?
------------------------------
Date: 23 Feb 1998 22:18:22 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: read char without echo
Message-Id: <6cssje$aq6$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Harald Wolf <HaraldWolf@swol.de> writes:
:exists a function which reads one single character from keyboard without
:echo ?
You mean other than the ways covered in perlfaq8 using POSIX or
Term::ReadKey, chapter 7 of the Camel under POSIX, the getc function in
perlfunc(1) or chapter 3 of the or the tsetattr stuff in Perl's POSIX(3)
manpage? Probably not. :-)
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Can you sum up plan 9 in layman's terms? It does everything
Unix does only less reliably --Ken Thompson
------------------------------
Date: Mon, 23 Feb 1998 22:48:03 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: regexp problem
Message-Id: <34faf5ba.2926019@news.tornado.be>
mkolus@atomico.com.ar wrote:
>Hello! Why this: s/^From:\s([^\S]*)/\1/i; return an string with the \n at
>the end?.. i also tried [^\n\r] and didnt work.
Next to all clever solutions to patch your replacement, I'd like to
suggest you to reconsider an alternative approach.
What you want is to kill everything but what's between parentheses? Then
just do this:
($from)=/^From:\s([^\S]*)/;
Think laterally.
HTH,
Bart.
------------------------------
Date: Mon, 23 Feb 1998 16:02:57 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: rejecting MIME mail (was Re: Killfile Triage)
Message-Id: <19980223.160257.6U1.rnr.w164w@locutus.ofB.ORG>
not perl-specific, obviously
tchrist@mox.perl.com (Tom Christiansen) writes:
> MIME mail not accepted; resend using plain ASCII, or make special
> arrangements with recipient.
wasn't it you who posted about how it was naove to assume you could
fit English into 7-bit ASCII?
(and don't most sendmails convert 8bit to quoted-printed still?)
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: 24 Feb 1998 00:08:11 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Send email from Perl on NT platform
Message-Id: <6ct31b$5f3$1@comdyn.comdyn.com.au>
In article <6cs9r4$9t9@camel20.mindspring.com>,
"Rick Ryan" <rickryan@datrixnet.com> writes:
> Is there a was to send email from a Perl script on the NT platform? If so,
> any code examples of how to use it would be appreciated.
You mean any other way than the one described in the Win32 FAQ,
question 9.7, or any other way than by using one of the Mail:: modules
on CPAN?
http://www.perl.com/CPAN/doc/FAQs/win32/Perl_for_Win32_FAQ_9.html#9_7
http://www.perl.com/CPAN/modules/
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: Tue, 24 Feb 1998 00:05:35 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Sorting that Hash on non-key field (part way there)
Message-Id: <34F20ECF.ED0EC045@world.northgrum.com>
Laurel Shimer wrote:
>
> Thanks to all of you who've guided my faltering footsteps on working with
> my associative array- a task you wouldn't have even had to think twice
> about.
>
> And not making me feel dumb.
We were all new to Perl once. And those of us who experienced the Perl4
to
Perl5 transition were new twice. :-)
>
> 1) I understand how to sort on the key fields.
> 2) I have been trying to sort on non-key fields, but I'm still confused -
> and I must admit the $a and $b business still seems like witchcraft to me,
> which is probably why I'm doing something wrong with them. Ok they are
> 'package globals' (in the sort package? I guess that functions are part of
> some default package my perl interpreter knows about without my explicitly
> telling it).
$a and $b are package globals in _your_package. That same package
contains the functions too. You set the package by means of a
'package My_PackageName;' statement. Since you omit this, the package
name defaults to 'main'.
> [... Comments and some working code omitted]
> foreach $key2 (sort byage %people) {
^^^^^^^
Aha! You mean
keys %people
not
%people
The former produces a list of the keys of the %people hash. I think
you know that. The latter produces a list containing both the keys
and the values. Since %people is a hash of hashes, its values
are Perl hash refs. Thus Perl expands %people to this list:
NAME#0 HASH(0xnnnnn) NAME#1 HASH(0xmmmmm) NAME#2 HASH(0xiiiii) ...
So besides asking for the age of Manuel, Elena, Elmer and the others
in your example you were asking for the age of Hash(0xbd4e0) and
so on.
There are no such keys in %people so Perl obligingly added them for you
when you referenced them in byage. But you didn't specify an age for
these non-existent people so Perl couldn't find one.
> [...]
That explains your output, which was:
> HASH(0xbd4e0) is years old and inches tall
> [8 more bad lines]
>
> Manuel is 51 years old and 13 inches tall
> [8 more good lines]
> [...]
By the way, the -w command-line flag and 'use strict;' will pinpoint
lots of these errors. Always use both in new code. E.g, they would
have warned that HASH(0xbd4e0)'s age and height were uninitialized.
Those are the basics but to really understand what's going on you need
to read more. Start with:
perlfunc -- For the basics of 'sort'
perlmod -- For the basics of packages
perlref -- To see what's really going on with those HASH(...)
thingies
Later you can read, e.g., some of Tom Christiansen's many excellent
tutorials on sorting, references and the like.
Good luck.
--
Jim Stern -- Views here are my own, not my employer's. (Hawthorne, CA)
------------------------------
Date: Mon, 23 Feb 1998 23:32:44 +0000
From: Joergen Lang <Joergen.Lang@no-spam.de>
Subject: Re: The Ineffable Tom C.
Message-Id: <34F2071B.868@no-spam.de>
what is this ?
A public tribunal ?
Joergen
--
____________________________________________________________
to reply please "no-spam" with "schwaben" - thanks
_____________________________________________________________
------------------------------
Date: Tue, 24 Feb 1998 00:25:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: why no Case statment?
Message-Id: <Eoux6u.AEq@world.std.com>
Tzadik Vanderhoof <stvhoof@netvision.net.il> writes:
>Why doesn't Perl have a real Case statement?
Are case statements in other languages so that the programmer can
write "neater" looking code than if-elsif-else statements or because
it represents a fundementally different programming concept?
To me, when I am writing an if-else in C, I'm imagining the compiler
is going to turn it into a compare instruction and a conditional
branch. when I'm writing a select-case statement, I imagine the
compiler will output a jump table. (especially if the cases are
closely spaced together. I'd be suspicious of writing a select-case
where the values are widely spaced.)
Now in perl, there used to be an optimization in which an
if-elsif-else chain would be optimized to a case statement if
appropriate. It doesn't help you if you think of a case statement as
an aesthetic construct, but it does if you think of it as a different
function (and perl will decide for you which one is better.) Also,
without the dangling else problem if-elsif-else chains aren't that bad
anyway.
--
Andrew Langmead
------------------------------
Date: 24 Feb 1998 01:36:03 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: why no Case statment?
Message-Id: <6ct863$6dr$1@comdyn.comdyn.com.au>
In article <34F1B90F.5709@netvision.net.il>,
Tzadik Vanderhoof <stvhoof@netvision.net.il> writes:
> Why doesn't Perl have a real Case statement? I've read what the Camel
> book says about the "alternatives", but none of them are really as nice
> as a real Case statement supported directly by the language. I realise
> that this is something that probably only Larry could answer, and I've
> heard he no longer sees this newsgroup, but maybe someone has some ideas
> about this...
The man pages say:
There is no official switch statement in Perl, because there
are already several ways to write the equivalent.
I tend to agree. Besides, an implementation of the switch statement in
c would be a lot less flexible. The syntax:
SWITCH:
{
(expr) && do
{
# statements
last SWITCH;
};
}
isn't that different from
switch (c)
{
case 'd':
/* statements */
break;
}
It's probably just not worth it to implement something that most
likley would be more restrictive.
The perl FAQ (section 7) has this to say:
Briefly, there's no official case statement, because of the
variety of tests possible in Perl (numeric comparison,
string comparison, glob comparison, regexp matching,
overloaded comparisons, ...). Larry couldn't decide how
best to do this, so he left it out, even though it's been on
the wish list since perl1.
So, basically, it was too hard to implement without losing the
flexibility, and it wasn't worth it, because there already was a
satisfactory alternative :)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: 23 Feb 1998 21:05:17 -0500
From: uri@sysarch.com
Subject: Re: why no Case statment?
Message-Id: <x7k9al3ggy.fsf@sysarch.com>
aml@world.std.com (Andrew M. Langmead) writes:
> Are case statements in other languages so that the programmer can
> write "neater" looking code than if-elsif-else statements or because
> it represents a fundementally different programming concept?
for compiler languages and those without perl's expressive power, case
statements are a different concept and in many cases neater code
results.
> To me, when I am writing an if-else in C, I'm imagining the compiler
> is going to turn it into a compare instruction and a conditional
> branch. when I'm writing a select-case statement, I imagine the
> compiler will output a jump table. (especially if the cases are
> closely spaced together. I'd be suspicious of writing a select-case
> where the values are widely spaced.)
since c's case in integer only it does generate a jump table unless the
values are sparse, then the compiler could do one of many tricks.
> Now in perl, there used to be an optimization in which an
> if-elsif-else chain would be optimized to a case statement if
> appropriate. It doesn't help you if you think of a case statement as
> an aesthetic construct, but it does if you think of it as a different
> function (and perl will decide for you which one is better.) Also,
> without the dangling else problem if-elsif-else chains aren't that bad
> anyway.
since perl can do integer, string or regex comparisons (as well as much
more complex expressions), a case syntax limited like other languages
doesn't gain much. and you should not need the 'else' which does ugly up
the code IMHO. i like the if { xxxx ; last } style. the xxxx expression
can be anything and each case entry is nicely isolated by {}. and all
the if's are in a larger block which could have a nice label for the last
statements. this allows nesting of cases and loops without ambiguity or
convoluted flags to control breaking out.
about the only thing other language case statements have going for them
is the selection of a single variable or expression for multiple
comparisons. this would be tricky in perl since you have to also speciy
the comparison operator which as i said before can be one of three major
types. and we don't need any more new syntax features for a well
supported semantic feature.
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: 23 Feb 1998 22:43:27 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Why not RegEx in $/?
Message-Id: <6csu2g$dkj$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Christian Wetzel
<cnwetzel@linguistik.uni-erlangen.de>],
who wrote in article <34F17414.5287@linguistik.uni-erlangen.de>:
> Why isn't it possible to use a regular expression for
> $/ ($INPUT_RECORD_SEPARATOR)? The perlvar page says:
Feel free to submit a patch which implements it. Nobody will object
against an inclusion of such a much-wanted feature.
Expect some problem, though, the fact that is not implemented may have
warned you.
Ilya
P.S. I have some ideas how to implement it, but it will require
changes to 3 different parts of Perl engine.
------------------------------
Date: Mon, 23 Feb 1998 22:48:08 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Why not RegEx in $/?
Message-Id: <34fbf6da.3214211@news.tornado.be>
Christian Wetzel <cnwetzel@linguistik.uni-erlangen.de> wrote:
>Why isn't it possible to use a regular expression for
>$/ ($INPUT_RECORD_SEPARATOR)? The perlvar page says:
>
> Remember: the value of $/ is a string, not a regexp.
> AWK has to be better for something :-)
I think the main objection is the probably large speed penalty for the
ordinary cases, where this isn't necessary.
Bart.
------------------------------
Date: 23 Feb 1998 18:29:47 -0500
From: uri@sysarch.com
Subject: Re: Why not RegEx in $/?
Message-Id: <x7n2fh3no4.fsf@sysarch.com>
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> > Why isn't it possible to use a regular expression for
> > $/ ($INPUT_RECORD_SEPARATOR)? The perlvar page says:
>
> Expect some problem, though, the fact that is not implemented may have
> warned you.
> P.S. I have some ideas how to implement it, but it will require
> changes to 3 different parts of Perl engine.
i wonder if it is a speed/memory issue. you may have to read far ahead
to make sure a regex will match/fail (read the book mastering
regexes). so you might force perl to slurp the entire file to
match/fail. whereas a fixed string $/ will match/fail in no more than
the length of $/.
so if you want it yourself, just set $/ to undef, slurp in the file and
do your own split or regex. it would be about the same work as perl
would do for you and not much more code on your part.
just my $.02
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: Mon, 23 Feb 1998 22:28:19 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Why PERL? [Re: Beginner in trouble]
Message-Id: <genepoolEourr7.HLG@netcom.com>
Joseph N. Hall (joseph@5sigma.com) wrote:
: Something I've always wondered is where people get the
: uppercase PERL thing from. Any ideas?
Their favorite TV show was Man From U.N.C.L.E. ?
No, I guess those people write P.E.R.L.. B.T.W., is
P.E.R.L. Y.2.K. compliant?
------------------------------
Date: Mon, 23 Feb 1998 23:28:28 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: Why PERL? [Re: Beginner in trouble]
Message-Id: <6ct133$31h@dfw-ixnews10.ix.netcom.com>
[posted and emailed]
"Joseph N. Hall" <joseph@5sigma.com> wrote:
>Something I've always wondered is where people get the
>uppercase PERL thing from. Any ideas?
They're probably doing that based on it being an acronym. I did at
first having heard of the "Practical Extraction and Report Language."
Cheers,
Jeff
-------------------------------
Jeff Yoak jeff@yoak.com
------------------------------
Date: 23 Feb 1998 20:55:59 -0500
From: uri@sysarch.com
Subject: Re: Why PERL? [Re: Beginner in trouble]
Message-Id: <x7lnv13gwg.fsf@sysarch.com>
jeff@yoak.com (Jeff Yoak) writes:
> They're probably doing that based on it being an acronym. I did at
> first having heard of the "Practical Extraction and Report Language."
that is apparently a retro-acronym, i believe, made up by larry after
the true origin of the name was lost or forgotten. don't flame me if i
am fuzzy on this.
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: Mon, 23 Feb 1998 16:29:28 -0600
From: Steve Dover <swd@strata-group.Xcom>
Subject: Re: y2k UNIX laundry list
Message-Id: <34F1F848.2E5B609A@strata-group.Xcom>
lvirden@cas.org wrote:
>
> According to Steve Dover <swd@strata-group.Xcom>:
> :Haven't been lurking here long have you?
> :Both Perl 4 and 5 are compliant, but you can code scripts
>
> No - I've been hanging around comp.lang.perl.misc, where the folk who
> make the claims are the ones writing the code...
>
Well, Larry Wall replied to me on 1997-06-28
--------------------------------------
Perl itself has no problem with the year 2000, since the ctime function
returns the year-1900. People would typically get into trouble by
treating the year (implicitly or explicitly) as year%100 instead.
For instance, the following would be wrong:
($sec,$min,$hour,$day,$month,$year)=ctime;
printf "Year: 19%d", $year;
Instead they should use something like:
printf "Year: %d",$year+1900;
---------------------------------------
I'm curious as to why some of the perl maintainers think
Perl 4 has different Y2k issues than Perl 5.
Xpost added.
------------------------------
Date: 23 Feb 1998 22:35:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: y2k UNIX laundry list
Message-Id: <6cstiv$bes$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Steve Dover <swd@strata-group.Xcom> writes:
:I'm curious as to why some of the perl maintainers think
:Perl 4 has different Y2k issues than Perl 5.
Because we shall never go fix perl4 programs whose programmers were not
y2k compliant. We might fix perl5 programs. Remember: it's not the
tool, it's the user. Perl is no less y2k compliant than your pencil--
and no more.
http://www.perl.com/perl/news/y2k.html
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
IBM: It may be slow, but it's hard to use.
- Andrew Tannenbaum <trb@ima.ima.isc.com>, author of Minix and Amoeba
------------------------------
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 1961
**************************************