[10068] in Perl-Users-Digest
Perl-Users Digest, Issue: 3661 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 8 16:07:49 1998
Date: Tue, 8 Sep 98 13:00:35 -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 Tue, 8 Sep 1998 Volume: 8 Number: 3661
Today's topics:
Re: <> Question <nguyend7@msu.edu>
Re: <> Question <JKRY3025@comenius.ms.mff.cuni.cz>
Re: <> Question (Abigail)
Re: COBOL and Perl <jdporter@min.net>
Re: crypt() on a NT system (Ethan H. Poole)
Exception.pm <mkolbuszewski@mail.cebra.com>
Re: Help with a bug in a soft! <strat@pacifier.com>
Re: How do I extract last line from multiline string? (Charles DeRykus)
Re: If/Then Statement <rabell@ti.com>
Linux (Apache) Web server, Perl accessing Access dbase? <mhughe@acs.ucalgary.ca>
merge arrays and strings beju@my-dejanews.com
Re: merge arrays and strings (Larry Rosler)
merging strings and arrays beju@my-dejanews.com
Re: mkdir and umask <nguyend7@msu.edu>
Re: Perl gurus opinion needed. <jdporter@min.net>
Re: Perl Programmer Needed (Roberto)
Re: Perl Programmer Needed <Richard@WowMe.com>
Re: Perl Programmer Needed <jimbo@soundimages.co.uk>
Re: Perl Programmer Needed <Richard@WowMe.com>
Re: Q: Converting C to Perl <aqumsieh@tigre.matrox.com>
Re: Randal Schwartz in Dallas on 10/3 (Brand and Karina Hilton)
Re: shell execution troubles (Charles DeRykus)
Re: Stripping out 'bad' HTML <cajun@expert.cc.purdue.edu>
Re: Stripping out 'bad' HTML (Abigail)
Re: trace statement similar to "set -x" in ksh? (M.J.T. Guy)
Re: uname -r (Michael J Gebis)
Re: uname -r <r28629@email.sps.mot.com>
Re: Why Perl ? <jdporter@min.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Sep 1998 18:24:59 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: <> Question
Message-Id: <6t3spr$qbd$1@msunews.cl.msu.edu>
Steve Debenport <steve.debenport@us.coopers.com> wrote:
: How do I within a 'While (<>)' and 'if' statement, skip a couple of
: lines at a certain point while stepping through a text file. I
: thought two simple '<>' would work, but it doesn't seem to. Any
: ideas? Thanks.
try
while( <> ) {
next if (your_condition);
.
.
.
}
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Tue, 08 Sep 1998 20:18:54 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: <> Question
Message-Id: <35F5F39E.1471@comenius.ms.mff.cuni.cz>
Steve Debenport wrote:
>
> How do I within a 'While (<>)' and 'if' statement, skip a couple of lines at a certain point while stepping through a text file. I thought two simple '<>' would work, but it doesn't seem to. Any ideas? Thanks.
> Steve Debenport
> Steve.Debenport@us.pwcglobal.com
The most usual way is
while (<>) {
next if some(condition,$_);
do($the->processing);
}
That is if you do not like the line, you skip it's processing
and ask for next ;-)
Now, even though I can only guess what do you mean by "doesn't work"
I think you mean something like this:
while (<>) {
....
if (something) {
<>;
}
...
working with $_;
}
But even if the condition holds $_ still contains the old data.
It wasn't updated by the new line.
The important thing is to remember is that :
"<HANDLE> sets the $_ variable IF AND ONLY IF used as the only
condition
in a while() loop!!!".
This means that if you want to find the line in $_ you MUST
explicitly store it there:
while (<>) { # here it sets $_
....
if (something) {
$_ = <>; # here you have to ask for it !
}
...
working with $_;
}
HTH, Jenda
------------------------------
Date: 8 Sep 1998 19:39:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: <> Question
Message-Id: <6t414k$re3$2@client3.news.psi.net>
Steve Debenport (steve.debenport@us.coopers.com) wrote on MDCCCXXXIV
September MCMXCIII in <URL: news:6t3nfa$pfq$1@news-2.news.gte.net>:
++ SG93IGRvIEkgd2l0aGluIGEgJ1doaWxlICg8PiknIGFuZCAnaWYnIHN0YXRlbWVudCwgc2tpcCBh
++ IGNvdXBsZSBvZiBsaW5lcyBhdCBhIGNlcnRhaW4gcG9pbnQgd2hpbGUgc3RlcHBpbmcgdGhyb3Vn
++ aCBhIHRleHQgZmlsZS4gIEkgdGhvdWdodCB0d28gc2ltcGxlICc8Picgd291bGQgd29yaywgYnV0
++ IGl0IGRvZXNuJ3Qgc2VlbSB0by4gIEFueSBpZGVhcz8gIFRoYW5rcy4NClN0ZXZlIERlYmVucG9y
++ dCANClN0ZXZlLkRlYmVucG9ydEB1cy5wd2NnbG9iYWwuY29tDQo=
Goodie. I think there's a bug on the third line.
Abigail
--
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
------------------------------
Date: Mon, 07 Sep 1998 15:36:12 -0400
From: John Porter <jdporter@min.net>
Subject: Re: COBOL and Perl
Message-Id: <35F435AC.50710098@min.net>
Shaun C. Murray wrote:
>
> In article <tglnnz8roi.fsf@noise.bsd.uchicago.edu>,
> d-edwards@nospam.uchicago.edu says...
> >
> >Silly e.g.: I don't think "a*b" is much more cryptic than "a times b,"
> >but then I wouldn't call the latter "much more verbose." As the
> >problems you typically deal with get more and more complicated than
> >multiplication, though, the dilemma of choosing between "more cryptic"
> >and "more verbose" (farther from / closer to the "English description"
> >of the operation the notation stands for) gets harder and harder.
>
> But thats just for maths you're describing. There is a well known notation for
> that that's evolved over 100's of years.
That was the whole idea behind Algol.
The fact that Perl is an Algol language is nothing against Perl, IMHO.
> >I mean yes, I have a vague idea of what's going on... the loop is
> >counting the records in the data-file, yes? But if it's doing more
> >than that I honestly missed it.
>
> Nope that's all it was doing and you had more than a vague idea. From not
> seeing any COBOL before, you know what the program segment was doing. Does that
> prove my point?
Only if you can honestly say that you don't have even the vaguest
notion of what the following code does:
do { &test_data } until $data_rec;
$percentage = 10;
print "hello";
open $data_file;
read $data_file, $data_record;
if ( eof )
{
print "end of file";
}
else
{
$rec_no = $rec_no + 1;
}
close $data_file;
exit;
> >Obviously I could learn all of these things about COBOL, just
> >as you could learn enough about perl to understand the tab-splitting
> >example from a few posts back.
>
> Actually, I thought that example was pretty lame. It was supposed to show a
> flaw in COBOL that the original programmer couldn't cope with non-fixed length
> fields yet the Perl example had the fields locations specified.
No, it was supposed to show in how few lines the algorithm could be
coded
in Perl, as an answer to the challenge that it could be done in fewer
lines
of COBOL. It did it in 3 lines of Perl (plus two comments), but I could
do it in one.
As has already been discussed, COBOL is quite capable of reading in
tab-separated variable-length fields; that was not the point.
Btw, what's wrong with specifying the widths of the output fields?
You would have to do as much (although via a very different syntax)
in COBOL.
Those who prefer "pictures" of the output might be more comfortable
with the following, which is an equivalent solution:
format =
@<<<<<<<@####.##@>>>>>>>
@_
.
do { split /\t/; write; } while <>;
Here, the output fields are specified in the format; this format
contains pictures for three fields -- the first is left-justified,
the third is right-justfied, and the second is right-justified
with fixed-point numeric.
> Where you would use {}, begin/end etc in other languages,
> you have END- scope delimiters eg.
>
> if var-a is greater than var-b then
> add var-a to var-b
> add var-c to var-b
> else
> display "fail"
> display "var-a is less"
> end-if
Just like Unix shell scripting languages (Bourne shell and C shell).
John Porter
------------------------------
Date: 8 Sep 1998 17:59:00 GMT
From: ehp@gte.net (Ethan H. Poole)
Subject: Re: crypt() on a NT system
Message-Id: <6t3r94$ne7$1@news-1.news.gte.net>
[Posted and Emailed] In article <6t3hjg$2mi$1@trader.ipf.de>,
ruetten@vivai.de says...
>
>Hello,
>
>please help me. I can use the cryp function in UNIX, but when i try to use
>it in Windows NT a strange error message appears : "crypt not implemented
>due to exessive paranoia".
>Is there a module or somthing else which allows to use the crypt function on
>NT.
Somewhere out there someone has released a crypt.pm module which you could
use in a pinch. Alternatively, the ActiveState port of Perl for Win32 does
have builtin support for the crypt() function.
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal========= | ============================
* ehp @ gte . net * | --Interact2Day--
http://home1.gte.net/ehp/ | http://www.interact2day.com/
------------------------------
Date: Tue, 08 Sep 1998 15:24:42 -0400
From: Marcin Kolbuszewski <mkolbuszewski@mail.cebra.com>
Subject: Exception.pm
Message-Id: <35F5847A.C9CECDE1@mail.cebra.com>
Hi!
"Advanced Perl Programming" book by Sriram Srinivasan says, on page 70,
"As this book goes to press, a new module, Exception.pm, built over eval
and die, is just being announced to CPAN".
Has anyone actually seen this module?
Cheers,
Marcin
------------------------------
Date: Tue, 8 Sep 1998 11:04:13 -0700
From: "Christian Brink" <strat@pacifier.com>
Subject: Re: Help with a bug in a soft!
Message-Id: <35f571c7.0@news.pacifier.com>
You should NEVER do an open with checking the result....
should be > open (FILE,"Dr129a.htm") || die print "Not";
I would recommend that you get Friedl's Mastering Regular Expressions book.
isbn 1-56592-257-3 O'Rielly and Assoc.
I cannot tell what you are trying to do in the RE's ,but several thing set
off a warning light
to me that you are not going to get what you want. (i.e. /\b (Date\b.*\b98)/
means find a
Boundry then a Space then the word Date then a Boundry then EVERYTHING (or
nothing) till you get Boundry and a 98)
exp.
" Date 98"
true
" Date and I said to the Rabbi *(&^% and it still looks like that 98"
true
" Date 1998"
False
"Date 12 12 98"
False
Plate Forme Jeunes Diplomes wrote in message
<35F521DF.F218C97A@wanadoo.fr>...
> Hello,
>
> I write you because I have got a bug in this script. It must extract
>data in a file dr129a.htm, after it must put it in a new file. The fisrt
>part has a bug, I don't know how can I make the second part.
>
> Thanks for your help,
>
> Fred.
>
>#!/usr/bin/perl
>
> while (<FILE>) {
> chomp;
> $offre=$1 if /\b (Offre\b.*\bX)/;
> $date=$1 if /\b (Date\b.*\b98)/;
> $Ale=$1 if /\b (Ale\b.*\bTD)/;
> $duree=$1 if /\b (Recherche\b.*\bFONT)/;
> $descriptif=$1 if /\b (CENTER\b.*\bFONT)/;
> $lieu=$1 if /\b (Lieu\b.*\bFONT)/;
> $horaires=$1 if /\b (Horaires\b.*\bFONT)/;
> }
>
> close (FILE);
>
> print $offre ;
> print $date ;
> print $Ale ;
> print $duree ;
> print $descriptif;
> print $lieu ;
> print $horaires
>
>
>
------------------------------
Date: Tue, 8 Sep 1998 18:12:44 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: How do I extract last line from multiline string?
Message-Id: <Eyz998.Jv3@news.boeing.com>
In article <MPG.105dad7a4ee2c8b989831@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted to comp.lang.perl.misc and copy mailed.]
>
> ...
>$x = "a\nb\nc\nd\n";
>$x =~ s/\n([^\n]*)\n$//; # $x becomes "a\nb\nc"
>$y = $1; # $y becomes "d"
>
This is easier to type and in many cases faster:
$x =~ s/\n(.*)\n$//;
--
Charles DeRykus
------------------------------
Date: Tue, 08 Sep 1998 13:18:48 -0500
From: Robert Bell <rabell@ti.com>
Subject: Re: If/Then Statement
Message-Id: <35F57508.640406DC@ti.com>
Jonathan M. Hartman wrote:
> if (!open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id"))
> {$error = 'Couldn\'t open file log file!';}
>
> Why won't the previous statement set the variable, when the file doesn't
> exist?
>
> -Jon
>
> ==============================================================================
> ||||||||"If you can't take the heat, STAY OUT OF THE FIREWALL!" -Me ||||||||||
> ==============================================================================
> ||Out the Token Ring, through the router, down the fiber, off another router,|
> ||||||||||| down the T1, past the firewall...nothing but Net.|||||||||||||||||
> ==============================================================================
Seems to work for me, but why don't you simply say
open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id") || ($error = 'Couldn\'t
open file log file!');
rabell ...
------------------------------
Date: Fri, 04 Sep 1998 10:16:53 -0600
From: Matt Hughes <mhughe@acs.ucalgary.ca>
Subject: Linux (Apache) Web server, Perl accessing Access dbase?
Message-Id: <6sp3tj$ka6@ds2.acs.ucalgary.ca>
Is there someway for a perl script running on a linux server to
access an access database? Is there anything like ODBC, SQL, or any kind
of connectivity code to do this? Would a Win machine have to be running
access, which would server data to the perl script? Any information on
this subject would be much appreciated.
Thanks,
Matt Hughes
------------------------------
Date: Tue, 08 Sep 1998 18:44:21 GMT
From: beju@my-dejanews.com
Subject: merge arrays and strings
Message-Id: <6t3tu5$3v3$1@nnrp1.dejanews.com>
hi folks,
i have a big problem with arrays.
how do i merge the contents of arrays and strings?
the task: i have some files, whose contents I want to summarize.
the output of the summary should be looks like this:
fileOne - number 1:
Here is the complete contents of the file fileOne...
fileTwo - number 2:
Here is the complete contents of the file fileTwo...
...and so on...
my idea:
##-----begin--
$num=0;
@name=("fileOne", "fileTwo", "fileThree");
foreach $name (@name)
{
$num++;
open (FH, $name);
@cont = <FH>;
close FH;
@hold = @hold.$name." - number ".$num.":\n".@cont."\n";
}
print "AND HERE IS ALL TOGETHER: \n", @hold;
##-----end--
at least for me it seems to be logical. ;-)
...but not for perl. :-(
i don't have any clues. can someone help me please?
thanks in advance...
--beju.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 8 Sep 1998 12:13:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: merge arrays and strings
Message-Id: <MPG.105f21be1242500c989799@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <6t3tu5$3v3$1@nnrp1.dejanews.com> on Tue, 08 Sep 1998 18:44:21
GMT, beju@my-dejanews.com <beju@my-dejanews.com> says...
...
> @hold = @hold.$name." - number ".$num.":\n".@cont."\n";
This is the way to append to a string, not to an array. Look at `perldoc
-f push`.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 08 Sep 1998 18:51:26 GMT
From: beju@my-dejanews.com
Subject: merging strings and arrays
Message-Id: <6t3ubd$4ga$1@nnrp1.dejanews.com>
hi folks,
i have a big problem with arrays.
how do i merge the contents of arrays and strings?
the task: i have some files, whose contents I want to summarize.
the output of the summary should be looks like this:
fileOne - number 1:
Here is the complete contents of the file fileOne...
fileTwo - number 2:
Here is the complete contents of the file fileTwo...
...and so on...
my idea:
##-----begin--
$num=0;
@name=("fileOne", "fileTwo", "fileThree");
foreach $name (@name)
{
$num++;
open (FH, $name);
@cont = <FH>;
close FH;
@hold = @hold.$name." - number ".$num.":\n".@cont."\n";
}
print "AND HERE IS ALL TOGETHER: \n", @hold;
##-----end--
at least for me it seems to be logical. ;-)
...but not for perl. :-(
i don't have any clues. can someone help me please?
thanks in advance...
--beju.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 8 Sep 1998 18:32:55 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: mkdir and umask
Message-Id: <6t3t8n$qbd$2@msunews.cl.msu.edu>
Liz Castro <liznet@cookwood.com> wrote:
: Here's a question about permissions. According to the Camel book, the mkdir
: function is affected by umask. But in my tests, it only seems to be
: _partially_ affected by the umask.
: For example, if my umask is 22 (which I would assume is pretty normal), and I
: use mkdir (directory, 0777), the directory has 755 permissions. So far so
: good. But if I say mkdir (directory, 0744), then the permissions are set at
: 744 (and not 722, which I expected). And if I say mkdir (directory, 0752),
: then the permissions are set at 0750, which is bizarre.
mkdir is 0777 -> 111 111 111
umask is 0022 -> 000 010 010
you get 0755 -> 111 101 101
mkdir is 0744 -> 111 100 100
umask is 0022 -> 000 010 010
you get 0744 -> 111 100 100
mkdir is 0752 -> 111 101 010
umask is 0022 -> 000 010 010
you get 0750 -> 111 101 000
if you don't see how umask work's I'll explain it.
The octal numbers are just representation of the premissions
rwx rwx rwx. If the umask bit is set to one then the ending
coresponding bit will be zero no matter what the mkdir value is.
-dan
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Mon, 07 Sep 1998 15:52:57 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl gurus opinion needed.
Message-Id: <35F43999.26DBC414@min.net>
thor wrote:
>
> why not just "perl" as in:
>
> j: "are you perl?"
> k: "yeah, man; i'm perl"
> j: "what about her?"
> k: "she's WAY perl!"
No, that's sounds to "perlitically correct".
--
John Porter
------------------------------
Date: 8 Sep 1998 18:52:36 GMT
From: roberto@toutatis.net (Roberto)
Subject: Re: Perl Programmer Needed
Message-Id: <roberto-ya02408000R0809982053340001@news.euronet.nl>
In article <35F569B9.87CDD7A8@shaw.wave.ca>, Rick Delaney
<rick.delaney@shaw.wave.ca> wrote:
> Roberto wrote:
> >
> > In article <8cyarun0nr.fsf@gadget.cscaper.com>, Randal Schwartz
> > <merlyn@stonehenge.com> wrote:
> > > And *they* are the ones
> > > that have decreed that job postings go in job groups, regardless of
> > > the category.
> >
> > None of the documents I have consulted at
> > http://www.netannounce.org/news.announce.newusers/ mentions anything
> > about job postings. Could you be more precise in pointing out the
> > exact location of this "decrete"?
>
> I guess you didn't look very hard. From _How to find the right place to
> post (FAQ)_:
>
> 2) Commercial Advertisements
>
> The general rule of thumb is that you need to take the time to
> learn where your advertisement is appropriate before you post it.
> If you are not sure where your advertisement is appropriate, don't
> post it. Another good rule of thumb is that unless the group's
> charter or FAQ specifically mentions that some limited types of
> advertising are welcome, you should assume that no commercial
> postings are allowed.
>
> Most Usenet users strongly disapprove of business advertising in
> non-business-related groups. In particular, anything that looks
> like a pyramid scheme or chain letter will draw floods of critical
> e-mail to both you and your machine administrators. Posting about
> a few items for sale, or a job opening, in an appropriate newsgroup
^^^^^^^^^^^^
> (such as misc.forsale.* or misc.jobs.*) is OK; posting an ad for
^^^^^^^
> your business to a hundred groups is not.
That does not even *sound* like a decrete that job postings go in job
groups, regardless of the category. It merely illustrates my understanding
of usenet that what is "off-topic" and what is not, is subject to
continuous dialog, debate and interpretation by -> the usenet community ==
the participants of the groups, and not by a handful of people, no matter
how many years they spend behind their keyboards, no matter how many books
they wrote.
--
roberto@toutatis.net
------------------------------
Date: Tue, 08 Sep 1998 19:07:49 GMT
From: "Richard" <Richard@WowMe.com>
Subject: Re: Perl Programmer Needed
Message-Id: <9gfJ1.2798$JW5.8411615@news.rdc1.md.home.com>
I think Rick has cleared this up:
> e-mail to both you and your machine administrators. Posting about
> a few items for sale, or a job opening, in an appropriate newsgroup
> (such as misc.forsale.* or misc.jobs.*) is OK; posting an ad for
> your business to a hundred groups is not.
This is a rule which I followed!
We all need to remember a few key things here.
1) Randal refers to "The Rules" as dating back two decades. Two decades
ago the Internet in general was a different animal. It was used mainly by
the military and by colleges for research purposes. Now, it involves so
much more. Things evolve. It doesn't make them worse (sometimes it does).
As Rick illustrated, the rules HAVE changed to allow for the larger audience
using the Internet. Men no longer have to wear hats and public and it is
acceptable for a woman to hold a job and vote. Imagine that! Sometimes
things were not right in the first place, so they change and in this case
they did!
2) I know I over-reacted. However, in retrospect, I am glad I did. This is
something which should have been discussed. It should be made clear to
those who don't understand that the rules have changed, that the Internet is
no longer their turf. It is now the turf of every man woman and child on
this planet. Like it or not. I can remember the day after Christmas, back
in the BBS days. How many new people came to flood our private world of the
BBBS. Year after year after year. The busy signals that resulted. Not
unlike the slowness of the net. It was frustrating. people would post
things in a group that one person would think inappropriate because it did
not pertain to them, but others, whom it pertained to, welcomed it.
Eventually you have to look back, and remember, you were not always an
expert and your world is changing around you. Sometimes it's hard to share,
but we all have to grow up and learn that just because something does not
interest us, doesn't mean it will go unappreciated by others.
3) I don't want to share anyone's private life publicly, but some of the
people who wrote me, looking for work, explained that they really needed
some project work because of things going on in their personal lives. These
people were really excited that I posted this here. There really IS NO
WHERE ELSE for them to go and look for this type of work because the job
newsgroups and other resources on the net are for full-time positions.
These people have full-time positions, they are just looking for a little
bit more to help make their ends meet. We are not a big company, we can't
hire people full-time. Where do we go to find people to do project based
work? If we go anywhere else, we pretty much are stuck to offering
full-time work to interest anyone, because the people who use the other
resources are looking for that.
PEACE,
Richard
Rick Delaney wrote in message <35F569B9.87CDD7A8@shaw.wave.ca>...
>Roberto wrote:
>>
>> In article <8cyarun0nr.fsf@gadget.cscaper.com>, Randal Schwartz
>> <merlyn@stonehenge.com> wrote:
>> > And *they* are the ones
>> > that have decreed that job postings go in job groups, regardless of
>> > the category.
>>
>> None of the documents I have consulted at
>> http://www.netannounce.org/news.announce.newusers/ mentions anything
>> about job postings. Could you be more precise in pointing out the
>> exact location of this "decrete"?
>
>I guess you didn't look very hard. From _How to find the right place to
>post (FAQ)_:
>
> 2) Commercial Advertisements
>
> The general rule of thumb is that you need to take the time to
> learn where your advertisement is appropriate before you post it.
> If you are not sure where your advertisement is appropriate, don't
> post it. Another good rule of thumb is that unless the group's
> charter or FAQ specifically mentions that some limited types of
> advertising are welcome, you should assume that no commercial
> postings are allowed.
>
> Most Usenet users strongly disapprove of business advertising in
> non-business-related groups. In particular, anything that looks
> like a pyramid scheme or chain letter will draw floods of critical
> e-mail to both you and your machine administrators. Posting about
> a few items for sale, or a job opening, in an appropriate newsgroup
> (such as misc.forsale.* or misc.jobs.*) is OK; posting an ad for
> your business to a hundred groups is not.
>
>--
>Rick Delaney
>rick.delaney@shaw.wave.ca
------------------------------
Date: 08 Sep 1998 20:12:57 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Perl Programmer Needed
Message-Id: <u67eyfmfa.fsf@jimbosntserver.soundimages.co.uk>
roberto@toutatis.net (Roberto) writes:
> > I guess you didn't look very hard. From _How to find the right place to
> > post (FAQ)_:
> >
> > 2) Commercial Advertisements
> >
> > The general rule of thumb is that you need to take the time to
> > learn where your advertisement is appropriate before you post it.
> > If you are not sure where your advertisement is appropriate, don't
> > post it. Another good rule of thumb is that unless the group's
> > charter or FAQ specifically mentions that some limited types of
> > advertising are welcome, you should assume that no commercial
> > postings are allowed.
> >
> > Most Usenet users strongly disapprove of business advertising in
> > non-business-related groups. In particular, anything that looks
> > like a pyramid scheme or chain letter will draw floods of critical
> > e-mail to both you and your machine administrators. Posting about
> > a few items for sale, or a job opening, in an appropriate newsgroup
> ^^^^^^^^^^^^
> > (such as misc.forsale.* or misc.jobs.*) is OK; posting an ad for
> ^^^^^^^
> > your business to a hundred groups is not.
>
> That does not even *sound* like a decrete that job postings go in job
> groups, regardless of the category. It merely illustrates my understanding
> of usenet that what is "off-topic" and what is not, is subject to
> continuous dialog, debate and interpretation by -> the usenet community ==
> the participants of the groups, and not by a handful of people, no matter
> how many years they spend behind their keyboards, no matter how many books
> they wrote.
Which part of the post did you find difficult to comprehend?
c.l.p.misc seems to be missing any reference whatsoever to commercial
undertakings. No forsale, no (would you believe it) jobs, nothing of
the sort that would lead anyone who reads and writes English as a
first language to believe that c.l.p.misc is commerce enabled.
Check the charter. No such reference will be found there either. Take
your foot and of your mouth and move on to the appropriate newsgroup
for your job related posting.
--
Jim Brewer
e-mailed courtesy copies are unappreciated, please refrain.
------------------------------
Date: Tue, 08 Sep 1998 19:22:13 GMT
From: "Richard" <Richard@WowMe.com>
Subject: Re: Perl Programmer Needed
Message-Id: <FtfJ1.2801$JW5.8419616@news.rdc1.md.home.com>
Not true Elaine. Actually, I am still receiving email from interested
parties. That fact alone proves the point that some people did appreciate
the post.
I will, however take your advice and relax, I would agree that I
overreacted, but it was not out of any sense of insecurity, it was out of
anger. I do think we should all be involved in helping people realize what
is appropriate and inappropriate on the Internet in general, but there is a
way to do it. One person, making themselves the policeman of what IS right
and IS wrong IS not the way. Making a friendly note to that person
privately is. Posting a message publicly saying it is a questionable post
and asking for feedback from the other users of the newsgroup is. But
dropping the gavel on something like this is not.
Richard
Elaine -HappyFunBall- Ashton wrote in message
<35F56432.FFEF107A@bbnplanet.com>...
>Goodness. Have a beer, get out your OED and look yourself up under
>'insecure'. It really wasn't a big deal. Also, I think if anyone were
>seriously interested in the position they certainly aren't anymore. Hey,
>at least you punctuated correctly. :)
>
>e.
------------------------------
Date: 08 Sep 1998 14:09:42 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Q: Converting C to Perl
Message-Id: <x3y3ea2pjbt.fsf@tigre.matrox.com>
Fred_Gurzeler@rand.org (Fred Gurzeler) writes:
>
> All,
>
> I am trying to convert a C program into Perl. Why? To see if I can do
> it, mostly; I haven't been programming in Perl for very long and my C
> skills are beyond rusty. I've amended the C and Perl code to the end of
> this post (it's the game Othello). The conversion to Perl should be
> relatively straightforward, but aside from adding a $ in front of every
> variable, I am having problems passing variables (including an array) from
> one function to another. No big whoop, normally, but one of the functions
> is recursive and there's quite a bit of array manipulation. I've tried
> making variables "local" or "my" and even renaming them,
Wooo .... hold on .. local() and my() are very similar .. yet very
different (due to the way they store the variables). Using them in a
"trial and error" fashion and hoping that things would work out will
lead you nowhere! Read perlfaq7 for a more thorough (yet not very
complete) explanation on the difference between my() and local();
> and while I can
> get a working program, "working" is relative because the Perl version
> doesn't run the same as the C version. Either I'm doing something wrong
> or it can't be done. If it can be done, I'm hoping someone will show me
> how. If it can't be done (or it can be done but not without rewriting the
> entire program), I'd like to know that, too.
I believe (without spending too much time on your code) that your
problem lies in passing the array @V recursively to the Minimax()
function. If you defined your array @V as a my() (lexical) variable,
then every time you enter the function, a new array @V is constructed,
populated, acted upon and then discarded as that recursive entry
ends. Thus, nothing will be reflected at the global @V array, which
will always remain the same.
Solution:
Pass the array's reference instead of the array. (Read perldoc perlref
if you need details).
Call Minimax as such:
Minimax($depth, $f, $_r, $alpha, $beta, \@V );
\@V is a reference to @V (similar, but not identical, to pointers in
C). This can be saved into a normal scalar:
$V = \@V;
To access the array again, you need to derefence it as such:
@$V
you can access the $i-th element as such:
$$V[$i]
>
> Thanks,
>
> Fred
>
>
> Here's the almost working Perl version:
>
> #!/usr/bin/perl
>
> @r = (-1,-11,-10,-9,1,11,10,9);
> @h = (11,18,81,88);
> @ih= (22,27,72,77);
> $lv = 60;
> $bz = 0;
> $m = 0;
> $level = 0;
> $t = 0;
> $y = 0;
>
> # minimax function with alpha-beta pruning
> sub Minimax
> {
> my($depth, $f, $_r, $alpha, $beta, @V ) = @_;
> local($c, $j, $w, $z, $i, $g, $q, $k) = 0;
>
> $D = $depth * 100;
>
> if ($depth < ($level - 1))
> {
> $j = $alpha;
> }
> else
> {
> $j = -9000;
> }
>
> $q = 3 - $f;
>
> if ($depth > $level)
> {
> for ($w = $i = 0; $i < 4; $i++)
> {
> $m = $V[$h[$i] + $D];
> if ($m == $f)
> {
> $w = $w + 300;
> }
> elsif ($m == $q)
> {
> $w = $w - 300;
> }
> else
> {
> $t = $V[$ih[$i] + $D];
> if ($t == $f)
> {
> $w = $w - 50;
> }
> elsif ($t == $q)
> {
> $w = $w + 50;
> }
> }
> }
> return $w;
> }
>
> $c = 0;
>
> for ($z = 11; $z < 89; $z++)
> {
> # find a valid move
> if (&Check_Move($depth, $z, $f, 100, @V ))
> {
> $c++;
> $w = -&Minimax($depth+1, $q, 0, -$beta, -$j, @V );
>
> if ($w > $j)
> {
> $g = $bz = $z;
> $j = $w;
>
> if ($w >= $beta || $w >= 8003)
> {
> return $w;
> }
> }
> }
> }
>
> if ($c == 0)
> {
> $g=0;
>
> if ($_r)
> {
> # count number of Xs and Os
> for ($k = 11; $k < 89; $k++)
> {
> if ($V[$k + $D] == $f)
> {
> $c = $c + 1;
> }
> elsif ($V[$k + $D] == (3 - $f))
> {
> $c = $c - 1;
> }
> }
>
> if ($c > 0)
> {
> return (8000 + $c);
> }
> else
> {
> return ($c - 8000);
> }
> }
>
> $y = 111;
> for ($k = 11; $k < 89; $k++)
> {
> $y++;
> $V[$y + $D] = $V[$k + $D];
> }
>
> $j = -&Minimax($depth + 1, $q, 1, -$beta, -$j, @V );
> }
> $bz = $g;
>
> if ($depth >= ($level - 1))
> {
> return ($j + ($c << 3));
> }
> else
> {
> return ($j);
> }
> }
>
> # check for valid move
> sub Check_Move
> {
> ($k1, $z1, $f1, $o1, @V) = @_;
> local($j, $q, $g, $i, $w, $d, $D) = 0;
>
> $D = $k1 * 100;
>
> $q = 3 - $f1;
> $g = 0;
>
> if ($V[$z1 + $D] == 0)
> {
> for ($i = 7; $i >= 0; $i--)
> {
> $w = $r[$i];
> $j = $z1 + $w;
>
> while ($V[$j + $D] == $q)
> {
> $j = $j + $w;
> }
>
> if ($V[$j + $D] == $f1 && ($V[$j - $w + $D] != $V[$z1 + $D]))
> {
> if ($g == 0)
> {
> $g = 1;
> $y = 111;
>
> for ($d = 11; $d <= 89; $d++)
> {
> $y++;
> $V[$y + $D] = $V[$d + $D];
> }
> }
>
> while ($V[$j + $D] != $V[$z1 + $D])
> {
> $V[$j + $o1 + $D] = $f1;
> $j = $j - $w;
> }
> }
> }
> }
> if ($g == 1)
> {
> $V[$z1 + $o1 + $D] = $f1;
> }
>
> return ($g);
> }
>
> sub print_board
> {
> local($d);
>
> printf("\n1 2 3 4 5 6 7 8\n");
> for ($d = 11; $d < 89; $d++)
> {
> if ($V[$d] == 0) { printf("%s", ". "); }
> elsif ($V[$d] == 1) { printf("%s", "X "); }
> elsif ($V[$d] == 2) { printf("%s", "O "); }
>
> if ($d%10 == 8)
> {
> $d += 2;
> printf(" %d\n", $d/10-1);
> }
> }
> }
>
> sub main
> {
> for ($t = 0; $t < 1600; $t += 100)
> {
> for ($m = 0; $m < 100; $m++)
> {
> if ($m < 11 || $m > 88 || ($m+1)%10 < 2)
> {
> $V[$t+$m] = 3;
> }
> else
> {
> $V[$t+$m] = 0;
> }
> }
> }
> printf("Level: ");
> $level = <STDIN>;
> chop($level);
>
> # Initialize board
> $V[44] = $V[55] = 1;
> $V[45] = $V[54] = 2;
>
> while ( $lv > 0 )
> {
> &print_board;
>
> do
> {
> printf("\nYou (O): ");
> $m = <STDIN>;
> chop($m);
> } while(!&Check_Move(0, $m, 2, 0, @V) && $m != 99);
>
> if ($m != 99)
> {
> $lv--;
> }
> if ($lv < 15 && $level < 10)
> {
> $level += 2;
> }
>
> &print_board;
>
> printf("\nThinking...\n");
> printf("Move value: %d\n", &Minimax(0, 1, 0, -9000, 9000, @V));
> $lv = $lv - &Check_Move(0, $bz, 1, 0, @V);
> printf("Computer moves to: %d\n", $bz);
> }
>
> # print the final board
> if ($lv == 0)
> {
> &print_board;
> }
> }
>
> &main;
>
> exit(0);
Hope this helps,
--
Ala Qumsieh | No .. not Just Another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Tue, 8 Sep 1998 17:58:28 GMT
From: bkhilton@netcom.com (Brand and Karina Hilton)
Subject: Re: Randal Schwartz in Dallas on 10/3
Message-Id: <bkhiltonEyz8LG.LDw@netcom.com>
In article <8cyarxrzyr.fsf@gadget.cscaper.com>,
Randal Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Brand" == Brand Hilton <bhilton@tsg.adc.com> writes:
>
>Brand> I've just learned from Randal that he's going to be in Dallas on
>Brand> Saturday, October 3rd. I'll give you more details as plans firm up,
>Brand> but in the mean time, everybody in Dallas and Ft. Worth free up your
>Brand> Saturday evening!
>
>Well, if *everybody* in DFW comes, we're gonna need a bigger room.
>Say, are those Cowboys using that there little stadium of yours that
>evening?
>
>:-)
No, but I think it's closed for repairs.
They found a big hole in the roof. :-)
Brand
------------------------------
Date: Tue, 8 Sep 1998 19:00:57 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: shell execution troubles
Message-Id: <EyzBHL.20A@news.boeing.com>
In article <6t114b$6hm$1@nnrp1.dejanews.com>, <ped2202@my-dejanews.com> wrote:
>I have a somewhat annoying problem with executing shell commands from within a
>perl script.
>
>A standard shell cmd might look like this:
>qx/sleep 10/; or system("sleep 10");
>and this works just as it should. The script forks out a process that could
>look like something like this:
>
>myuser 1323 10149 0.1 19:15:39 ttyp4 0:00.01 sleep 10
>myuser 10149 32029 0.0 19:18:07 ttyp4 0:00.01 perl -w foo.pl
>
>and will return to the perl script nicely.
>
>
>The problem crops up when you try something like this:
>
>qx/su - newuser -c sleep 10/;
>
>Here, perl obviously checks for several commands and to be sure everything
>works allright it adds a 'sh -c' (eg. fork a new shell and execute whatever
>is after the '-c' flag)
>
Whatever is after the '-c' flag must be a single string
argument though. The shell won't parse correctly if
there's whitespace:
$/bin/sh -c sleep 1
usage: sleep time
So, as you discovered, you'll need to quote the string.
hth,
--
Charles DeRykus
------------------------------
Date: Tue, 8 Sep 1998 13:21:38 -0500
From: "Jonathan M. Hartman" <cajun@expert.cc.purdue.edu>
Subject: Re: Stripping out 'bad' HTML
Message-Id: <Pine.GSO.3.96.980908132115.12464B-100000@expert.cc.purdue.edu>
On 8 Sep 1998, Abigail wrote:
> Jeremy Goldberg (jgoldberg@dial.pipex.com) wrote on MDCCCXXXIII September
> MCMXCIII in <URL: news:6t06kf$q3p$1@plug.news.pipex.net>:
> ++ Does anyone have a decent algorithm (or a module, hint, hint) to take text
> ++ and strip out 'bad' HTML e.g. "3 < 5" (which should be written as "3 <
>
> What is bad about "3 < 5"?
If you don't know, you won't be of any help to him...
>
> ++ 5") without stripping 'good' HTML e.g. "<b>3 is less than 5</b>"? It would
> ++ be good to allow users to put in HTML (in news articles, say, or message
> ++ board articles) without letting them wreck their HTML utterly.
>
> I can't parse this. If they put in HTML, then what's wrong with that?
>
> ++
> ++ Any ideas gratefully appreciated.
> ++
> ++ - Jeremy (fix the email address to reply)
>
> Spam bait: jgoldberg@dial.pipex.com
>
>
>
> Abigail
> --
> sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
> "$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
> *_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
> _::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
>
>
==============================================================================
||||||||"If you can't take the heat, STAY OUT OF THE FIREWALL!" -Me ||||||||||
==============================================================================
||Out the Token Ring, through the router, down the fiber, off another router,|
||||||||||| down the T1, past the firewall...nothing but Net.|||||||||||||||||
==============================================================================
------------------------------
Date: 8 Sep 1998 19:36:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Stripping out 'bad' HTML
Message-Id: <6t4107$re3$1@client3.news.psi.net>
Jonathan M. Hartman (cajun@expert.cc.purdue.edu) wrote on MDCCCXXXIV
September MCMXCIII in <URL: news:Pine.GSO.3.96.980908132115.12464B-100000@expert.cc.purdue.edu>:
++ On 8 Sep 1998, Abigail wrote:
++
++ > Jeremy Goldberg (jgoldberg@dial.pipex.com) wrote on MDCCCXXXIII September
++ > MCMXCIII in <URL: news:6t06kf$q3p$1@plug.news.pipex.net>:
++ > ++ Does anyone have a decent algorithm (or a module, hint, hint) to take text
++ > ++ and strip out 'bad' HTML e.g. "3 < 5" (which should be written as "3 <
++ >
++ > What is bad about "3 < 5"?
++
++ If you don't know, you won't be of any help to him...
Oh, I do know. You can convince me otherwise if you show me the SGML
production rules which go wrong.
Don't forget to mail the people maintaining SGML software. You've
found a bug that has been unnoticed for over 10 years!
Abigail
--
Or perhaps, "3 < 5" *is* correct HTML?
------------------------------
Date: 8 Sep 1998 18:00:10 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: trace statement similar to "set -x" in ksh?
Message-Id: <6t3rba$sqq$1@pegasus.csx.cam.ac.uk>
<muehlhuber@my-dejanews.com> wrote:
>
>The "set -x" turns on the trace option for the ksh.
>How can this be done in perl.
>The switch "perl -dt ....." seems to do something different.
You probably want to learn about the Perl debugger - see
perldoc perldebug.
In particular, the debugger "t" command may be what you want. But you
can also do lots of other cleverer things.
Mike Guy
------------------------------
Date: 8 Sep 1998 18:04:16 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: uname -r
Message-Id: <6t3rj0$bq4@mozo.cc.purdue.edu>
"Thomas Wong" <twong@exchange.ml.com> writes:
}Is there a built-in perl function to get the OS release version instead of
}using something like system ("uname -r"). thx
Take a look at "use Config;" Read the man page, too.
However, it's not clear that this is actually any better than just
using uname yourself.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Tue, 08 Sep 1998 13:33:10 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: uname -r
Message-Id: <35F57866.1B1C8EB1@email.sps.mot.com>
Thomas Wong wrote:
>
> All,
> Is there a built-in perl function to get the OS release version instead of
> using something like system ("uname -r"). thx
try this:
use Config;
print "$Config{osname} $Config{osvers}"; # print 'Solaris 2.5' on my
machine
-TK
------------------------------
Date: Mon, 07 Sep 1998 15:47:34 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Why Perl ?
Message-Id: <35F43856.C0C9CA1E@min.net>
M.J.T. Guy wrote:
>
> The traditional way of doing (almost) this is
> perl -wde 42
> You don't even have to write a script.
> And the Perl debugger gives you history as well.
Yes; it looks like the debugger is prolly using Term::ReadLine
(not sure)...
But it DOESN'T use Shell. These both failed to DWIM:
% perl -wde ''
DB<1> use Shell;
% perl -MShell -wde ''
--
John Porter
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3661
**************************************