[9872] in Perl-Users-Digest
Perl-Users Digest, Issue: 3465 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 17 15:07:43 1998
Date: Mon, 17 Aug 98 12:00:23 -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 Mon, 17 Aug 1998 Volume: 8 Number: 3465
Today's topics:
ASP,perlscript,@array David@iqtexas.com
ATP what is it? <user@cisco.com>
Re: CGI on Browser (Sean McKenna)
Re: CGI.pm TEMP files not deleted on NT after file uplo bjohnsto_usa_net@my-dejanews.com
Re: comp.lang.perl.newbie <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Continuing misunderstanding of symbol table manipulatio (Sean McAfee)
Re: Converting to lowecase (Craig Berry)
Don't have 65535 lines (was Re: Enhance Warning meaning <ckuskie@cadence.com>
Downloading with perl script under IIS <fcalabro@aisvt.bfg.com>
Re: Downloading with perl script under IIS (Maurice Aubrey)
Error output problem. <jmurray@tibco.com>
Re: is there a way to prevent the dos window from closi <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Re: is there a way to prevent the dos window from closi (Matthew Bafford)
newbie question SDunkin@oxfordinc.com
Re: newbie question (Sean McAfee)
Re: newbie question (Matthew Bafford)
Pattern substitution using perl zaxaz@my-dejanews.com
Re: Pattern substitution using perl <jdf@pobox.com>
Re: PERL and file updates <abarfoot@eng.auburn.edu>
Re: Perl Style <zenin@bawdycaste.org>
Re: Q: How to read all the file name in a directory <upsetter@ziplink.net>
Re: Q: How to read all the file name in a directory <upsetter@ziplink.net>
Re: Q: How to read all the file name in a directory <upsetter@ziplink.net>
Re: Random access <upsetter@ziplink.net>
Re: Random Number (Abigail)
Re: Random Number <grant.griffin@nospam.com>
Re: Recommend a good editor kbquinn@my-dejanews.com
Re: Search for a character <guillaume@nospam.com>
Substituting patterns using perl 5 zaxaz@my-dejanews.com
Re: timeout or time limiting function <grant.griffin@nospam.com>
Understanding the behavior of $^X <jkternes@firehawk.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 17 Aug 1998 18:15:35 GMT
From: David@iqtexas.com
Subject: ASP,perlscript,@array
Message-Id: <6r9s06$6ah$1@nnrp1.dejanews.com>
Code:
$key=$Request->Cookies()->{logon};
$Response->write($key);
$Response->write("<br>");
$Response->write(join("<br>",split(/&/,$key)));
Output:
password&john&logon&john&remember&on
Win32::OLE=HASH(0x3c6ef30)
What's going on?!!
Thanks.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 17 Aug 1998 11:38:44 -0700
From: user <user@cisco.com>
Subject: ATP what is it?
Message-Id: <35D878B4.18F0B9DE@cisco.com>
I come across this Advanced Template Package, what is this
and hwo and why do the CGI programmers need this?
Thanks in Advance
Anu
------------------------------
Date: Mon, 17 Aug 1998 17:19:46 GMT
From: sean@mckennaprod.com (Sean McKenna)
Subject: Re: CGI on Browser
Message-Id: <35db64ea.1210644@nntp1.ba.best.com>
On Mon, 17 Aug 1998 13:06:44 GMT, ikarydis@my-dejanews.com wrote:
>You can also try the
>Personal Web Server on Windows 95 but I'm not sure if it supports CGI.
Or try the OmniHTTPd server available at:
http://www.omnicron.ab.ca/httpd/
Small footprint. Good Perl/CGI support. I found it easier to set up
and use than the Microsoft personal web server. YMMV.
Sean McKenna "All the world's a stage..."
------------------------------
Date: Mon, 17 Aug 1998 17:20:19 GMT
From: bjohnsto_usa_net@my-dejanews.com
Subject: Re: CGI.pm TEMP files not deleted on NT after file upload
Message-Id: <6r9ooj$1qc$1@nnrp1.dejanews.com>
In article <6qigt3$nr5$1@wbnws01.ne.highway1.com>,
"Todd B" <tbeaulieu@mediaone.net> wrote:
> FAQ says to make sure to close the file as a solution to this. i am
> definately closing the file, but they still remain in the temp dir.
>
> i suppose i will attempt to retrieve the filename and manually delete it
> after processing it.
>
> anyone seen this behavior and have the real solution, or understand how it
> is supposed to be deleted automatically?
>
I am suffering from this behavior too.
I looked for a way to find out the name of the file associated with the a file
handle so I could do the delete in the script after processing.
I guess I will have to institute a clean-up process as part of my daily batch
runs.
Brendan Johnston
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 17 Aug 1998 17:25:05 GMT
From: "Sabre Taylor" <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Subject: Re: comp.lang.perl.newbie
Message-Id: <01bdca03$dcc2aba0$c1620c8a@lnxcompaq.lexis-nexis.com>
Craig Berry <cberry@cinenet.net> wrote in article
<6r61a5$pms$1@marina.cinenet.net>...
> Kermit the frog (kermit@sesamestreet.com) wrote:
> : Why are you so fucking bitchy, loser???
[ snippage ]
> : I agree, perhaps, that there should maybe be a
> : comp.lang.perl.misc.newbie group or something, but how would these
> : questions get answered?
>
> By reading the doc, without recourse to Usenet unless clarification is
> required, perhaps?
>
> : The users frequenting that group would be
> : inexperienced and may not be able to answer most, if not all of the
> : questions asked due to their limited knowledge of the language.
>
> Bingo.
I think such a group would be worthwhile. The learning process is such
that human interaction is of great help especially during the initial
stages.
Not all newbies are callously selfish and I'm sure some are refraining
from asking basic questions that they're having genuine difficulty with.
I think the most serious disadvantage of such a group would be possible
culture pollution that could spill out of it. (Thinking long-term effects
of having sister group with minimal restraint.)
my 2c. Not quite enough to buy a happy meal, but ah well.
------------------------------
Date: Mon, 17 Aug 1998 17:21:09 GMT
From: mcafee@choplifter.rs.itd.umich.edu (Sean McAfee)
Subject: Continuing misunderstanding of symbol table manipulation (was Re: Have package use another symbol table?)
Message-Id: <9EZB1.855$QT4.4232788@newbabylon.rs.itd.umich.edu>
In article <u33go2g1.fsf@mailhost.panix.com>,
Jonathan Feinberg <jdf@pobox.com> wrote:
>mcafee@qbert.rs.itd.umich.edu (Sean McAfee) writes:
>> perl -e '$x = 10; %FOO:: = %::; print "$FOO::x\n";'
>> After the symbol table assignment, inserting 'print $FOO::{"x"}' shows that
>> $FOO::{"x"} is *main::x, as it should be, but 'print $FOO::x' doesn't
>> display 10.
>> What's going on here?
>The scalar referred to by the typeglob $FOO::{x} is spelled
>${$FOO::{x}} or, if you're feeling particularly obfuscatory,
>${*{$FOO::{x}}{SCALAR}}.
It is also spelled $FOO::x.
>Remember the $FOO::{x} is a value in the
>hash %FOO:: (which happend to be a typeglob), and that it is not the
>scalar $FOO::x.
Yes, but that isn't what I was asking about.
$FOO::x = 10; # The typeglob $FOO::{x} now has the value "10"
# hanging off it in the scalar slot
%BAR:: = %FOO::; # Equivalent to $BAR::{x} = $FOO::{x}; the typeglob
# $BAR::{x} should now have the value "10" in its scalar
# slot, the *same* "10" that's in $FOO::{x}'s scalar slot.
print $BAR::x; # Ought to print "10", but doesn't.
Replacing "%BAR:: = %FOO::" with "$BAR::{x} = $FOO::{x}" produces the
results I expect. Why aren't the two identical, presuming that package
FOO's symbol table contains only the typeglob "x"?
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 17 Aug 1998 18:27:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Converting to lowecase
Message-Id: <6r9sm2$aub$1@marina.cinenet.net>
Hauk Langlo (hauk@forumnett.no) wrote:
: Craig Berry wrote:
:
: > The *very first line matching the string 'lowercase' gives you your
: > answer! Now, wouldn't that have been easier to do, rather than waiting
: > for an answer from Usenet, and bothering thousands of people?
:
: You are ofcourse right about that. The problem has been though that due to
: some problems with my software, the server I'm using etc, I have not been
: able to use the perl man and docs lately.
Dude, they're shipped with Perl, available in a multitude of forms on the
web, and also in printed form for a reasonable price. Barring
circumstances more bizarre than I can currently imagine, there is simply
no way *not* to have access to Perl doc, if you have a net-capable
computer -- which you clearly do, given that you're posting to Usenet.
: Besides, I find it kind of strange
: that this board seem pretty hostile to newbies in general.
Bzzzzt, category error! Not hostile to newbies; welcoming, friendly, and
supportive to newbies. Hostile to people who ask questions easily
answered by consulting FAQs/docs. That's a huge difference.
: If someone ask a question that is in the experts eye pretty basic,
: instead of offering a tip or solution the poor newbie is slagged of and
: told to read the manuals (like if he had not tried this allready).
Which you clearly didn't, making you worthy of slagging. I have *never*
*once* seen a poster who had clearly made a good-faith attempt to use the
docs get flamed. *NEVER* *ONCE*. It doesn't happen. So your arguments
are entirely missing the point.
: I remember the friendly enviroment there used to be on similar Amiga
: programing boards some years ago. There people would help eachother out no
: matter what kind of stupid questions was asked. If this board are supposed to
: be for proffesional programmers only, then it should be clearly stated
: somewhere.
We could have such an environment here, if people would do their homework
before coming to the table. We *do*, among those who do so already.
: And I'm apologizing to the tousands of people i have bothered with my
: question.
Thank you very much. Now, go visit www.perl.com, or your local bookstore,
or whatever, and obtain and *read* the Perl docs. You'll benefit
tremendously, and your further participation on clpm will be met with joy.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Mon, 17 Aug 1998 10:22:47 -0700
From: Colin Kuskie <ckuskie@cadence.com>
To: bill@fccj.org
Subject: Don't have 65535 lines (was Re: Enhance Warning meaning, possibly?)
Message-Id: <Pine.GSO.3.96.980817101521.7667C-100000@pdxmail.cadence.com>
On Sat, 15 Aug 1998, Bill 'Sneex' Jones wrote:
> Value of <HANDLE> construct can be "0"; test with defined() at
> LastNamesBOLD.pl
> line 65535 (#1)
>
> PS - I don't have 65,535 lines in the script either,
> which is also a little misleading. :]
This is a known bug with 5.004_04. Chip Salzenburg posted a patch that
was supposed to fix it at the end of his announcement for 5.004_04. I
tried it, found that it didn't and after consulting some of the p5p people
got a patch from Tim Bunce.
Now, perl5.005 is out, and I hear talk of another maintenance release of
perl5.004 (to put out perl5.004_05). I'd expect either/both of them to
include the fix.
Happy patching,
Colin
*** ./op.c.dist04 Wed Nov 12 09:44:23 1997
--- ./op.c Wed Nov 12 09:44:53 1997
***************
*** 2835,2840 ****
--- 2835,2841 ----
redo = LINKLIST(listop);
if (expr) {
+ copline = whileline;
op = newLOGOP(OP_AND, 0, expr, scalar(listop));
if (op == expr && op->op_type == OP_CONST &&
!SvTRUE(cSVOP->op_sv)) {
op_free(expr); /* oops, it's a while (0) */
------------------------------
Date: Mon, 17 Aug 1998 13:28:29 -0400
From: Finn Calabro <fcalabro@aisvt.bfg.com>
Subject: Downloading with perl script under IIS
Message-Id: <35D8683D.2B7CEE94@aisvt.bfg.com>
I need a script that will copy a document off the web (actually a Word
document public for our intranet) and store it on the server. The
server it will be stored on (and the perl script running on) is IIS on
NT4.0 (i've already got it set up and it's running cgi's fine). The
Word doc is actually on a novell server, but i've got iis set up with a
virtual drive linking to its unc (so you can get to the file via its
address, http://server.ourcompany.com/novellserver/file.doc, but not by
ftping to the server). So I think the script would have to read it the
same way a browser reads files, and then save a copy on the nt server.
hope that makes sense and that someone can help me out. thanks.
------------------------------
Date: Mon, 17 Aug 1998 18:11:36 GMT
From: maurice@hevanet.com (Maurice Aubrey)
Subject: Re: Downloading with perl script under IIS
Message-Id: <slrn6tgsiq.kqu.maurice@we-24-130-48-83.we.mediaone.net>
On Mon, 17 Aug 1998 13:28:29 -0400, Finn Calabro <fcalabro@aisvt.bfg.com> wrote:
>I need a script that will copy a document off the web (actually a Word
>document public for our intranet) and store it on the server. The
>server it will be stored on (and the perl script running on) is IIS on
>NT4.0 (i've already got it set up and it's running cgi's fine). The
>Word doc is actually on a novell server, but i've got iis set up with a
>virtual drive linking to its unc (so you can get to the file via its
>address, http://server.ourcompany.com/novellserver/file.doc, but not by
>ftping to the server). So I think the script would have to read it the
>same way a browser reads files, and then save a copy on the nt server.
>hope that makes sense and that someone can help me out. thanks.
You need the LWP library. You can obtain it at your nearest CPAN site.
http://www.perl.com/CPAN-local/modules/by-module/LWP/
Once installed, your task is very simple:
use LWP::Simple qw( get );
$doc = get 'http://server.ourcompany.com/novellserver/file.doc';
defined $doc or die 'unable to fetch document';
# save doc to file
Hope that helps,
--
Maurice Aubrey <maurice@hevanet.com>
The first condition for the establishment of perpetual peace is the
general adoption of the principles of laissez-faire capitalism.
- Ludwig von Mises
------------------------------
Date: Mon, 17 Aug 1998 09:33:32 -0700
From: Jason Murray <jmurray@tibco.com>
Subject: Error output problem.
Message-Id: <35D85B5B.A0C85861@tibco.com>
I am writing a script to log in to a list of machines on my network and
execute a command. Some machines are a diffrent flavor of unix and
fail. When the command succeds I use:
$results = `rsh $machine <command>` and get the results in the variable
$results.
When the command fails I don't get the error in $results. Can anyone
tell me how I can get the error. So I can rexecute the command with
diffrent options.
Thanks,
jason
------------------------------
Date: 17 Aug 1998 17:31:49 GMT
From: "Sabre Taylor" <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Subject: Re: is there a way to prevent the dos window from closing after running a perl program in win32?
Message-Id: <01bdca04$cd94c180$c1620c8a@lnxcompaq.lexis-nexis.com>
Mike Ostenberg <mikeo@stiv.com> wrote in article
<6r5uql$hg6$1@pollux.dnai.com>...
>
> Is there a way to prevent the dos window from automatically closing after
> running a perl program?
Try powertoys from www.microsoft.com. Somewhere there is
option to make DOS windows stay open after execution.
Or make shortcut to it and change the Properties of the
shortcut.
Sabre
------------------------------
Date: Mon, 17 Aug 1998 19:11:42 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: is there a way to prevent the dos window from closing after running a perl program in win32?
Message-Id: <MPG.1042418b6467b91598969a@news.scescape.net>
In article <ltu33daxe7.fsf@asfast.com> on 16 Aug 1998 09:06:56 -
0400, Lloyd Zusman (a) typed:
> "Mike Ostenberg" <mikeo@stiv.com> writes:
> > Is there a way to prevent the dos window from automatically closing after
> > running a perl program?
>
> You could put an END block in your program, as follows:
>
> END {
> $input = <STDIN>;
> }
>
> This block should get invoked as your program is ending, even when
> there is a run-time error. Of course, this won't help if there's a
> syntax error in your program.
Actually, (at least on my machine) if you put the end at the
beginning it works fine.
Ie:
#!/usr/bin/perl -w
END{print "The End!\n"};
2=;
END{print "The End(2)!\n"};
__END__
Prints:
syntax error at perl line 5, near "="
Execution of perl aborted due to compilation errors.
The End!
Hope this helps!
--Matthew
------------------------------
Date: Mon, 17 Aug 1998 17:08:16 GMT
From: SDunkin@oxfordinc.com
Subject: newbie question
Message-Id: <6r9o1v$m5$1@nnrp1.dejanews.com>
Greetings, I'm trying to break a comma separated file into columns. Because I
am just starting to learn perl, I am encountering some difficulty. Can
someone point me in the right direction on how to do this?
My input file will look like this:
123,name,name2,1
456,name3,name27,2
and I need the output to look like this:
123 name name2 1
456 name3 name27 2
Thanks!
Scott Dunkin
Computer Engineer
Oxford Industries, Inc.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 17 Aug 1998 17:38:44 GMT
From: mcafee@choplifter.rs.itd.umich.edu (Sean McAfee)
Subject: Re: newbie question
Message-Id: <EUZB1.859$QT4.4243232@newbabylon.rs.itd.umich.edu>
In article <6r9o1v$m5$1@nnrp1.dejanews.com>, <SDunkin@oxfordinc.com> wrote:
>Greetings, I'm trying to break a comma separated file into columns. Because I
>am just starting to learn perl, I am encountering some difficulty. Can
>someone point me in the right direction on how to do this?
>My input file will look like this:
>123,name,name2,1
>456,name3,name27,2
>and I need the output to look like this:
>123 name name2 1
>456 name3 name27 2
Two of the many ways to do it are to use forms (see the perlform manual
page) or the sprintf function (see the perlfunc manual page).
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Mon, 17 Aug 1998 19:27:46 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: newbie question
Message-Id: <MPG.1042453befd987b298969b@news.scescape.net>
In article <6r9o1v$m5$1@nnrp1.dejanews.com> on Mon, 17 Aug 1998
17:08:16 GMT, SDunkin@oxfordinc.com (a) felt the following
information to be of use:
> Greetings, I'm trying to break a comma separated file into columns. Because I
> am just starting to learn perl, I am encountering some difficulty. Can
> someone point me in the right direction on how to do this?
>
> My input file will look like this:
> 123,name,name2,1
> 456,name3,name27,2
>
> and I need the output to look like this:
> 123 name name2 1
> 456 name3 name27 2
>
> Thanks!
> Scott Dunkin
> Computer Engineer
> Oxford Industries, Inc.
Open the file via open.
Read in the file, most likely with the angle <> operator.
Chomp the line.
Split the line.
(man perlfunc, or perldoc -f split)
Write the line.
For this, I'd either use a format, or sprintf.
(man perlform, or perldoc perlform)
or
(man perlfunc, or perldoc -f sprintf)
Close the file via close.
Hope this helps!
--Matthew
Choosing to _help_ newbies with _help_, not flames.
------------------------------
Date: Mon, 17 Aug 1998 17:17:51 GMT
From: zaxaz@my-dejanews.com
Subject: Pattern substitution using perl
Message-Id: <6r9ojv$1mb$1@nnrp1.dejanews.com>
I am trying to substitute leading and trailing double quotes from each line in
a numbe of files. Is this something easily accomplished using perl. I would
like to substitute the pattern then rewrite each file in sequence.
Thanks,
Scott Slattery
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 17 Aug 1998 14:45:32 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: zaxaz@my-dejanews.com
Subject: Re: Pattern substitution using perl
Message-Id: <u33btmsj.fsf@mailhost.panix.com>
zaxaz@my-dejanews.com writes:
> I am trying to substitute leading and trailing double quotes from
> each line in a numbe of files. Is this something easily accomplished
> using perl. I would like to substitute the pattern then rewrite each
> file in sequence.
This is easily accomplished in Perl, given a good book and a few days
of attentive reading while doing exercises from the book. I recommend
the O'Reilly book _Learning Perl_. Here's one way (yes, this is a
complete program):
perl -i~ -pe 's/^"|"$//g' file1 file2 file3 ...
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Mon, 17 Aug 1998 11:43:10 -0500
From: andy barfoot <abarfoot@eng.auburn.edu>
To: Debbie Ervine <debbie@jot.nb.ca>
Subject: Re: PERL and file updates
Message-Id: <Pine.SOL.3.96.980817113519.5379D-100000@leahy.eng.auburn.edu>
Assuming your records can vary in length, yes.. you'll have to rewrite the
file.
Instead, if the records' fields are fairly small (not more than a few
lines of text each), you could put the data in a DBM rather than a plain
textfile. That would speed things up. Look up the functions 'dbmopen' and
'dbmclose' in your perl book/manpages.
good luck,
--
andy.barfoot@eng.auburn.edu
On Mon, 17 Aug 1998, Debbie Ervine wrote:
> Hi!
>
> I'm under the gun here and I'm hoping some one can help me.
>
> I need to read a file (one record at a time) and under certain conditions,
> move new data to a portion of the record and rewrite the record. Is there
> any way to do this in PERL?
> As I see it, my only option is to open the file, read all the records into
> an array and do any processing at the same time, then close the file. Next I
> would open in read mode, which would of course destroy the original file,
that should be 'write' mode btw
> write the contents of my array to the file and close it again. In effect,
> this would mean recreating an entire file every time I need to update a
> record.
> Two questions: am I making any sense here?
> and: is there an easier way to do this?
>
> Any help would be greatly appreciated!
>
> Debbie
>
>
>
>
------------------------------
Date: 17 Aug 1998 18:23:40 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl Style
Message-Id: <903378854.804934@thrush.omix.com>
Scott Erickson <Scott.L.Erickson@HealthPartners.com> wrote:
: Previously, Tom Christiansen <tchrist@mox.perl.com> wrote:
>snip<
: >Anyone who thinks "or" is more legible than "||", or "BEGIN" is more
: >legible than "{", should go try playing the calculus without recourse
: >to any symbolic notation.
:
: What about calculus? If I was doing calculus, I would use math
: notation. But I am not, I am use Perl, so I will use Perl language
: constructs.
You just made Tom's point exactly.
The fact is, you *are* using Perl, but you are going out of your
way to avoid it's most basic primitive constructs. There is
a reason "||" existed before "or".
The only reason "||" doesn't say "or" to one's mind as quickly or
faster even then "or" is simply because they haven't been
programming in C styled languages for long enough.
: >Man is, above all, the creature that abstracts -- the creature that
: >symbolizes. Enough with dinosaur programming already. If you want Cobol,
: >you know where to find it.
:
: So, are you unable to abstract out 'or' as a possible substitute for
: '||' in some situations? Sort of seems that way.
AFASK "or" was built with one goal; To reduce the number of
perens. Because it "looked less like C" can probably be considered
a bug in retrospect.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 17 Aug 1998 18:45:11 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <6r9tnn$nj@fridge.shore.net>
Tom Christiansen <tchrist@mox.perl.com> wrote:
: I can tell you're new around here, because you obviously haven't figured
: out yet that these energy-sucking lazy sorts will just keep coming back
: for free handouts. We have to teach them to read. Ignorance of the
: documentation is no excuse. They shouldn't be using Perl all all if
: they can't read its documentation. They should go back to flipping
: hamburgers or whatever the nontechnical types and non-self-enabling
: types normally do.
Well, your policy of "abuse and insult" doesn't seem to have done much to
stem the tide in the two years I've been reading this newsgroup, but if
you keep it up for a couple more months, it'll probably work...
--Art
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 17 Aug 1998 18:41:26 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <6r9tgm$nj@fridge.shore.net>
Lloyd Zusman <ljz@asfast.com> wrote:
: Telling a kid he or she is a "selfish leech" for asking a question
: about riding a bike does not teach him anything worthwhile, either.
: Nor does ranting at the kid about how he or she is one of "a million
: sloppering bike-riding-wannabes" (replace "bike-riding" with
: "programming" for an exact quote of Tom's), nor does going on about
: how he or she is an example of "these energy-sucking lazy sorts", nor
: is following all that up with how "we must be harsh" and this is
: "tough love". All this taken together (which is how it was presented)
: borders on abuse.
Borders?
--Art
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 17 Aug 1998 18:47:37 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <6r9ts9$nj@fridge.shore.net>
I R A Aggie <fl_aggie@thepentagon.com> wrote:
: Ah, you mean like the baby grad-level stats course I took? where on
: the first day the guy next to me asked "whats a mean?" and I simply
: groaned?
You mean you didn't say "What kind of stupid idiot are you for coming into
this course without knowing what a mean is? It's you slobbering
wannabe-stats-mongers that are destroying our educational system!!" ???
How is he supposed to learn if all you did was groan?
--Art
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 17 Aug 1998 18:53:28 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Random access
Message-Id: <6r9u78$nj@fridge.shore.net>
Randal Schwartz <merlyn@stonehenge.com> wrote:
:>>>>> "No" == No Brain <no_brain@mailcity.com> writes:
: No> I want a short example to make, write and read files with random access.
: No> :-)) No Brain
: OK, useful challenge. Here goes:
[succinct code example snipped]
Now, how is he ever going to learn for himself if you don't insult him??
--Art
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 17 Aug 1998 17:56:01 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Random Number
Message-Id: <6r9qrh$lbe$1@client3.news.psi.net>
Darren Ferguson (Darren@introdesign.com) wrote on MDCCCXII September
MCMXCIII in <URL: news:35d8473c.2260737@news.demon.co.uk>:
++ Is there a random number command for Perl or in fact a routine.
Is there something wrong with your eyes?
How hard is it to grep for 'random' in the documentation?
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Mon, 17 Aug 1998 12:33:06 -0500
From: Grant Griffin <grant.griffin@nospam.com>
To: Greg Bacon <gbacon@cs.uah.edu>
Subject: Re: Random Number
Message-Id: <35D86952.C43DE25C@nospam.com>
Greg Bacon wrote:
> In article <35d8473c.2260737@news.demon.co.uk>,
> Darren@introdesign.com (Darren Ferguson) writes:
> : Is there a random number command for Perl or in fact a routine.
>
> Did you even bother to read the FAQ or the docs or some book on Perl?
> I found 38 occurrences of `random' grepping through the FAQ and docs.
I know that "Windows People" (if that's what Darren is) supposedly deserve
automatic scorn around here, but to my knowledge, Windows comes with nothing like
"grep". I'm sure many grep or grep-like programs are available on the net, but
unless you have heard of a grep program somewhere, you may not have even thought
of the concept. In my own case, for years I have used a grep that came with
Turbo Pascal--but I didn't psychically know about it before I discovered it
there.
Anyway, the term "grepping" probably doesn't mean much to the uninitiated (such
as people who don't grep), so maybe somebody like this needs to be given a grep
URL, along with your helpful advice. (Anybody know where a grep program for
Windows is? Anybody written one in Perl?--There can't be much to it.)
=g2
------------------------------
Date: Mon, 17 Aug 1998 18:03:20 GMT
From: kbquinn@my-dejanews.com
Subject: Re: Recommend a good editor
Message-Id: <6r9r98$52q$1@nnrp1.dejanews.com>
In article <6r30n6$ep0$1@msunews.cl.msu.edu>,
Dan Nguyen <nguyend7@msu.edu> wrote:
[ snip ]
>
> What could be better than emacs?
Why, vi, of course!
(ducking and covering...)
kbq
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 17 Aug 1998 18:04:06 +0100
From: "Planet News" <guillaume@nospam.com>
Subject: Re: Search for a character
Message-Id: <6r9nth$bha$1@newsreader2.core.theplanet.net>
$start = 'no';
open OUTPUT, ">>source.dat" or die "cannot append to output: $!";
chdir "/home/web/ushop/public_html/audit" or die "Cannot chdir: $!";
for $filename (<*>) { # get all filenames in current directory
open IN, $filename or die "Cannot read $filename: $!";
chomp(@a = <IN>); # read all lines of this file
foreach(@a){
$start = 'yes' if($_ eq '*');
push(@vals,$_) if($start eq 'yes');
}
print OUTPUT join (",",@vals), "\n"; # print lines 1,3,7 etc (offset
by one)
close IN;
unlink $filename or die "Cannot delete $filename: $!";
}
Hope this helps,
Guillaume.
----------------------------------------------
Guillaume Buat-Menard
guillaume@deepend.co.uk
Deep End Design Ltd
40-42 Scrutton Street, London EC2A 4QL
+44 (0) 171 247 2999
http://www.deepend.co.uk
----------------------------------------------
Alan Melton wrote in message <35D5B0F7.DB44B1AA@home.net>...
>I have written a short perl program to convert
>individual ascii files arranged vertically into
>a single database, comma delimited,then delete the original file.
> i.e. original file:
>
>new
>NY
>November
>1997
>*
>0.99
>0.00
>6.00
>0.0
>0.00
>6.99
>
>the program:
>
>#!/usr/local/bin/perl
>
># Age and erase stale audit files.
>
>open OUTPUT, ">>source.dat" or die "cannot append to output: $!";
>chdir "/home/web/ushop/public_html/audit" or die "Cannot chdir: $!";
>for $filename (<*>) { # get all filenames in current directory
> open IN, $filename or die "Cannot read $filename: $!";
> @a = <IN>; # read all lines of this file
> chomp (@vals=@a[1,2,3,4,5,6,7,8,9,10]);
> print OUTPUT join (",",@vals), "\n"; # print lines 1,3,7 etc (offset
>by one)
> close IN;
> unlink $filename or die "Cannot delete $filename: $!";
>}
>
>result:
>
>NY,November,1997,*,0.99,0.00,6.00,0.0,0.00,6.99
>
>
>New problem: in the original single file, there is always a *
>
>new
>OH
>August
>1998
>* <--------------------
>112.70
>0.00
>12.50
>5.75
>6.48
>131.68
>
>I would like to do the same as before but only pull out the data
>after the * sign and put that into one file.
>
>Any suggestions on how to search for the * and then
>read ONLY the lines after them, and export them to a file
>as in the original program?
>
>
>Thanks,
>Alan Melton
------------------------------
Date: Mon, 17 Aug 1998 17:17:52 GMT
From: zaxaz@my-dejanews.com
Subject: Substituting patterns using perl 5
Message-Id: <6r9ok1$1mc$1@nnrp1.dejanews.com>
I am attempting to replace leading and trailing double-quotes in a series of
files. I would like to use a regular expression like s/^\"//g and s/\"$//g to
remove these quotes from each line.
Is this easily accomplished by opening reading and rewriting each file?
thanks,
Scott Slattery
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 17 Aug 1998 11:23:01 -0500
From: Grant Griffin <grant.griffin@nospam.com>
Subject: Re: timeout or time limiting function
Message-Id: <35D858E5.C39365B8@nospam.com>
Tom Christiansen wrote:
> In comp.lang.perl.misc, an Lame Address Munger <grant.griffin@nospam.com>
> toothlessly trolls:
Sorry to be like this, but I just gotta know: Did you ever graduate from
Kindiegarden? They teach you not to call names there.
Some of us don't like getting three to five hundred e-mails per day,
particularly about pornography and get-rich quick schemes. Even so, I shall
continue to respect _your_ right to receive them!
respectfully yours,
=g2
------------------------------
Date: Fri, 14 Aug 1998 14:57:05 -0400
From: Kevin Ternes <jkternes@firehawk.com>
Subject: Understanding the behavior of $^X
Message-Id: <35D48881.D5B05228@firehawk.com>
Can someone help me understand this?
The perlvars man page says that $0 "Contains the name of the file
containing the Perl script being executed". Makes sense.
And it says that $^X contains "The name that the Perl binary
itself was executed as, from C's argv[0]"
Here's a simple script, /usr/local/bin/x.pl:
#!/usr/bin/perl
print "\n \$^X = $^X \$0 = $0 \n\n";
And here I am executing it:
www:/usr/local$ x.pl
$^X = x.pl $0 = /usr/local/bin/x.pl
www:/usr/local$ perl bin/x.pl
$^X = perl $0 = bin/x.pl
www:/usr/local$ bin/x.pl
$^X = /usr/bin/perl $0 = bin/x.pl
It's easy to understand the behavior of $0 here.
But for $^X, the first two instances above make sense but
why is the "name of the Perl binary itself" changing like
it does in the 3rd instance? Because I specified the path
to the script?
If it matters, I'm using 5.004_04 on HP-UX 10.20.
-kevin
--
Kevin Ternes mailto:jkternes@firehawk.com
------------------------------
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 3465
**************************************