[11204] in Perl-Users-Digest
Perl-Users Digest, Issue: 4804 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 2 09:07:17 1999
Date: Tue, 2 Feb 99 06:00:14 -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 Tue, 2 Feb 1999 Volume: 8 Number: 4804
Today's topics:
Re: Can "push" be used on anonymous arrays - syntax hel <brett_s_r@hotmail.com>
Re: Can "push" be used on anonymous arrays - syntax hel (Bart Lateur)
Re: code to recurse directories (Randal L. Schwartz)
Re: Comments in Perl code (Bart Lateur)
Re: Comments in Perl code (brian d foy)
DBI <andrewf@beausys.demon.co.uk>
Re: Filtering... (Randal L. Schwartz)
Re: getting MODEM responses in unix <andrew.cutler@team.xtra.co.nz>
Re: i may be stupid <allan@due.net>
Re: i may be stupid <jon@jonstuff.force9.co.uk>
Re: Match Parens-More Perlish? (Bart Lateur)
Re: Need Tutorial <23_skidoo@geocities.com>
Re: NEWBIE: Premature end of script header <andrew.cutler@team.xtra.co.nz>
opening files by date pault2000@my-dejanews.com
Re: opening files by date (Bart Lateur)
Re: opening files by date (Randal L. Schwartz)
Re: Perl Criticism topmind@technologist.com
Q: Perl in real work. <vrudowit@onestone.de>
Question about Regular Expression kaz@eudoramail.com
testing if tape loaded in drive <jont@uk.uu.net.nospam>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 02 Feb 1999 22:32:23 +1100
From: Brett Randall <brett_s_r@hotmail.com>
Subject: Re: Can "push" be used on anonymous arrays - syntax help?
Message-Id: <36B6E247.427DD27F@hotmail.com>
Thanks Larry - works great.
Brett
Larry Rosler wrote:
> [Posted and a courtesy copy mailed.]
>
> In article <36B6A95D.3936AC2E@hotmail.com> on Tue, 02 Feb 1999 18:29:33
> +1100, Brett Randall <brett_s_r@hotmail.com> says...
> ...
> > Within the function &add_key, I would like to "push" a value onto each
> > anonymous array stored in @$sorted_rows, but I can't seem to get the
> > syntax correct. I am trying :-
> >
> > --- start code snip ---
> > push(@$sorted_rows->[0], $new_field);
> > --- end code snip ---
>
> push(@{$sorted_rows->[0]}, $new_field);
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: Tue, 02 Feb 1999 11:18:15 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Can "push" be used on anonymous arrays - syntax help?
Message-Id: <36b9ddce.12668396@news.skynet.be>
Brett Randall wrote:
>@rows is an array of anonymous array references
>Later on, this array is sorted according to what is in the anonymous
>arrays, to produce @sorted_rows (also an array of anonymous array
>references).
>I would like to "push" a value onto each
>anonymous array stored in @$sorted_rows, but I can't seem to get the
>syntax correct.
Say what? First you say that @sorted_rows is an array, and now you're
saying it's an array reference. Make up your mind.
>I am trying :-
>push(@$sorted_rows->[0], $new_field);
I don't get it. What is that "->[0]" for?
Anyway. Attempt something like:
push @{$sorted_rows[$i]}, $new_field;
to add a new item on the end of the anonymous array in $sorted_row[$i].
HTH,
Bart.
------------------------------
Date: 02 Feb 1999 04:28:27 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: code to recurse directories
Message-Id: <m1lnihf0r8.fsf@halfdome.holdit.com>
>>>>> "gwebb" == gwebb <gwebb@reedtech.com> writes:
gwebb> The following code does pretty much the same thing as 'ls -R',
gwebb> but not so nicely formated.
[snipped again]
PLEASE stop reinventing a broken version of File::Find. You are doing
a disservice by posting your code.
For my last 17 rants about that, go see DejaNews.
<sigh>
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 02 Feb 1999 11:10:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Comments in Perl code
Message-Id: <36b7dace.11900709@news.skynet.be>
Tom Christiansen wrote:
>No. Your reasoning is flawed. It doesn't matter whether it's
>single-tasking or multi-tasking. The effect of comments on the execution
>speed of Perl code is precisely the same as the effect of comments on
>the execution speed of C code : to wit, exactly zero, zilch, and nada.
>No matter how many comments you put in C code, it will never run any
>slower. No matter how many comments you put in Perl code, it will never
>run any slower. Perhaps I might interest you in a compiler class?
But the compiling itself will be slowed down, most due to reading of
the larger file.
C programs are totally insensitive to this, because they're precompiled.
Perl programs are compiled each time on startup, so they might start up
a little bit slower. A *little* bit. Of course, once running, the speed
will no longer be affected.
Bart.
------------------------------
Date: Tue, 02 Feb 1999 08:44:19 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Comments in Perl code
Message-Id: <comdog-ya02408000R0202990844190001@news.panix.com>
[reply-to set]
In article <36b6d06d@csnews>, tchrist@mox.perl.com (Tom Christiansen) posted:
> :I mean... maybe I misunderstand this... but isn't there a bit of
> :a server performance difference where memory is an issue when
> :you are opening about 137,000 bytes of files with comments
> :compared with 98,000 bytes without when you have about 65+ users
> :accessing the system at the same time? Unix servers are fast and
> :rule the natural universe, but geez, *everything* has to have
> :some breaking point, or at least a downward curve.
>
> No. Your reasoning is flawed. It doesn't matter whether it's
> single-tasking or multi-tasking. The effect of comments on the execution
> speed of Perl code is precisely the same as the effect of comments on
> the execution speed of C code : to wit, exactly zero, zilch, and nada.
is your point that run-time is not affected, without saying anything
about compile-time? there's a lot more to performance than Perl's
run-time phase. file size certainly has a noticeable effect on the
compile-time phase my system, even without looking at top which showed
me a big spike in load.
[note: long.pl has 1173521 lines of 80 char wide comments. the other
two lines are the same as the short.pl example below.]
sri[72] wc -l long.pl
1173523 long.pl
sri[73] time perl long.pl
just another perl monger
28.0u 5.0s 0:45 72% 0+0k 0+0io 0pf+0w
granted, a lot of that time could be interaction with the filesystem,
but that's the nature of the beast. Perl is text, and when you run
Perl scripts, you read a text file.
so now let's try the same thing with no comments.
sri[74] cat > short.pl
#!/usr/bin/perl
print "just another perl monger\n";
sri[75] time perl short.pl
just another perl monger
0.0u 0.0s 0:00 0% 0+0k 0+0io 0pf+0w
now, if a lot of users are on the system, and they're all using Perl
because it's a really nifty tool and it gets the job done, and they're
all running a really big script with a lot of comments (like a certain
free scripts programmer), performance is going to take a hit because
of the extra thrashing perl has to do to go through that file.
> No matter how many comments you put in C code, it will never run any
> slower. No matter how many comments you put in Perl code, it will never
> run any slower. Perhaps I might interest you in a compiler class?
should we try the same thing with C? i assume gcc is acceptable for
a demonstration.
[long.c had 1916789 lines of one line /* */ comments. a bit longer
than the Perl example, but one can always normalize the numbers.]
sri[112] wc -l long.c
1916797 long.c
sri[113] wc -l short.c
8 short.c
sri[114] time gcc short.c
0.0u 0.0s 0:02 0% 0+0k 0+0io 0pf+0w
sri[115] time gcc long.c
0.0u 22.0s 0:59 36% 0+0k 0+0io 0pf+0w
so we've discovered that a larger file size takes a C compiler longer
to digest as well. that is not a surprise to most of us. should we
try it in Java to get somewhere inbetween the two? i don't think that
there will be any surprises with javac.
of course, compiling is different than running, and you may want to
point that out in that compiler course that you offered. the fallacy in
your approach is that you didn't mention Perl has a compile phase each
time you run the script, whereas a C compiler will produce a binary that
can be run without re-compiling. seems like a pretty important point
to ignore. for those systems that run a lot of Perl scripts, the
effect is quite noticeable. that's a reason mod_perl was invented ;)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
no CC is necessary
------------------------------
Date: Tue, 2 Feb 1999 11:49:38 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: DBI
Message-Id: <FJpPGCASZut2EwJ7@beausys.demon.co.uk>
I can (and do) use Perl under UnixWare 7.0.1, UnixWare 2.1.3 and Win95
(ActiveState ActivePerl), and I am trying to get to grips with DBI...
but it appears that none of these Perl packages has the DBI module(s).
Is it possible to obtain the DBI module(s) from somewhere and then just
incorporate them into these Perl packages (by some means) ?
Any (helpful) comments appreciated.
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: 02 Feb 1999 04:34:37 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Filtering...
Message-Id: <m1hft5f0gy.fsf@halfdome.holdit.com>
>>>>> "Sultan" == Sultan <Sultan@dumein.com> writes:
Sultan> Bram, you can use the if then sequence in this way:
Sultan> if($FileName!~/\.\b/)
Sultan> {
Sultan> print $FileName;
Sultan> }
Sultan> that will filter out all the files that begin with '.'
Nope. It gets rid of all files that have a dot followed by some
alphanumeric-or-underscore character. "Begin with dot" looks like this:
/^\./
Sultan> if
Sultan> however you are tryign to get rid of all files that have a dot
Sultan> in them at all then simply use:
Sultan> if($FileName !~/\./)
Sultan> {
Sultan> print $FileName;
Sultan> }
Yup.
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 03 Feb 1999 02:07:31 +1300
From: Andrew Cutler <andrew.cutler@team.xtra.co.nz>
Subject: Re: getting MODEM responses in unix
Message-Id: <36B6F892.B04509B@team.xtra.co.nz>
--------------47961F7D79CBE211C117F933
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Oh yeah,
Went through the agony of that a while ago until I found the Expect module.
Apart from the fact that it includes examples to control the modem it meant I
could stop using TCL/Expect. Yahoo!
Grab it from your local CPAN site and give it a go. Email me if you have any
problems and I'll try to help.
Cheers
Chris Bergeron wrote:
> I've tried different things, but none work... I'm trying to read the "RING"
> from my modem when a call comes in...
>
> i use the sysread function in a loop, but it only works until the first call
> comes in...
> has anyone done this successfully before?
--
Linux Potato...
And not a big in sught!!!
--------------47961F7D79CBE211C117F933
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Oh yeah,
<p>Went through the agony of that a while ago until I found the Expect
module. Apart from the fact that it includes examples to control the modem
it meant I could stop using TCL/Expect. Yahoo!
<p>Grab it from your local CPAN site and give it a go. Email me if you
have any problems and I'll try to help.
<p>Cheers
<p>Chris Bergeron wrote:
<blockquote TYPE=CITE>I've tried different things, but none work... I'm
trying to read the "RING"
<br>from my modem when a call comes in...
<p>i use the sysread function in a loop, but it only works until the first
call
<br>comes in...
<br>has anyone done this successfully before?</blockquote>
<pre>--
Linux Potato...
And not a big in sught!!!</pre>
</html>
--------------47961F7D79CBE211C117F933--
------------------------------
Date: Tue, 2 Feb 1999 07:46:29 -0500
From: "Allan M. Due" <allan@due.net>
Subject: Re: i may be stupid
Message-Id: <UsCt2.366$L1.7709@nntp1.nac.net>
Steve Palincsar wrote in message <36B65098.D4DD22DD@his.com>...
:jon wrote:
:> all the files have been placed in the cgi-bin and the path to perl.exe is
:
:Files loaded with "require" have to be on the search path
:specified in
:the array @INC. Is your cgi-bin directory on that path?
He did say all the files were in cgi-bin. As the current directory (.) is
part @INC there is no problem when the required file is in the same directory.
AmD
------------------------------
Date: Tue, 2 Feb 1999 12:47:13 -0000
From: "jon" <jon@jonstuff.force9.co.uk>
Subject: Re: i may be stupid
Message-Id: <XuCt2.21078$%3.1372@wards>
what happend when you tried to run this,
>or test compile it with a -cw ? Perl is usually quite
>good at giving you useful error messages.
when i try to run this i get the following:
htmlhead.pl did not return a true value at hellowww.pl line 6
so if i include the line 1; at the end of the two sub routine files
it should work ok. I'll try it out and thanks for the help to all
cheers
jon
------------------------------
Date: Tue, 02 Feb 1999 12:47:40 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Match Parens-More Perlish?
Message-Id: <36b7f2d6.17948007@news.skynet.be>
frogsmock@my-dejanews.com wrote:
>I've been messing with approaches to matching arbitrarily nested constructs
>in Perl, and read with interest the various posts that said it couldn't be
>done using regular expressions. Anyway, I'm fairly new to Perl, and I've
>come up with this approach for matching nested parentheses. But it *feels*
>ugly, so . . .
It looks ugly too.
It can't be done with regular expressions alone, because recursively
defined structures are more powerful than regular expressions. As thy
say, "you need a parser". Here's a simple one (but untested).
$depth = 0;
while(/(\()|\)/g) { #match the next "(" or ")"
if($1) { # "("
$depth++;
} else { # ")"
-- $depth < 0 and die "Unmatched closing paren";
}
}
$depth and die "More opening than closing parens";
HTH,
Bart.
------------------------------
Date: Tue, 02 Feb 1999 12:27:49 +0000
From: 23_skidoo <23_skidoo@geocities.com>
Subject: Re: Need Tutorial
Message-Id: <36B6EF3C.4D23@geocities.com>
actually that first one is wrong, should just be
http://perl.miningco.com
-23
Duane Lunday wrote:
>
> two good sites are http://www.perl.miningco.com or
> http://www.activestate.com
>
> Good luck!
------------------------------
Date: Wed, 03 Feb 1999 01:46:50 +1300
From: Andrew Cutler <andrew.cutler@team.xtra.co.nz>
Subject: Re: NEWBIE: Premature end of script header
Message-Id: <36B6F3B9.9FC8C161@team.xtra.co.nz>
--------------95A28A9121A81B8B995526AB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I had the same thing with Apache when I upgraded to 5.005_02. I hope the bit from
the Apache FAQ below helps, it worked great for me.
Cheers
14.What does it mean when my CGIs fail with "Premature end of script headers"?
It means just what it says: the server was expecting a complete set of HTTP
headers (one or more followed by a blank line), and didn't get them.
The most common cause of this problem is the script dying before sending the
complete set of headers, or possibly any at all, to the server. To
see if this is the case, try running the script standalone from an
interactive session, rather than as a script under the server. If you get error
messages, this is almost certainly the cause of the "premature end of script
headers" message.
The second most common cause of this (aside from people not outputting the
required headers at all) is a result of an interaction with Perl's
output buffering. To make Perl flush its buffers after each output statement,
insert the following statements around the print or write statements
that send your HTTP headers:
{
local ($oldbar) = $|;
$cfh = select (STDOUT);
$| = 1;
#
# print your HTTP headers here
#
$| = $oldbar;
select ($cfh);
}
This is generally only necessary when you are calling external programs from
your script that send output to stdout, or if there will be a long
delay between the time the headers are sent and the actual content starts
being emitted. To maximize performance, you should turn
buffer-flushing back off (with $| = 0 or the equivalent) after the statements
that send the headers, as displayed above.
If your script isn't written in Perl, do the equivalent thing for whatever
language you are using (e.g., for C, call fflush() after writing the headers).
Another cause for the "premature end of script headers" message are the
RLimitCPU and RLimitMEM directives. You may get the message if
the CGI script was killed due to a resource limit.
Eugene Sotirescu wrote:
> William B. wrote:
> >
> > I'm attempting to setup perlshop and am receiving the above error. Can anyone
> > tell me what it means and how to solve the problem?
>
> What's perlshop?
>
> --
> Eugene
>
> "Light is the all-exacting good,
> That dry, forever virile stream
> That wipes each thing to what it is,
> The whole, collage and stone, cleansed
> To its proper pastoral."
> Alvin Feinman
--
Linux Potato...
And not a big in sught!!!
--------------95A28A9121A81B8B995526AB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I had the same thing with Apache when I upgraded to 5.005_02. I hope the
bit from the Apache FAQ below helps, it worked great for me.
<p>Cheers
<p>14.What does it mean when my CGIs fail with "Premature end of script
headers"?
<p> It means just what it says: the server
was expecting a complete set of HTTP headers (one or more followed by a
blank line), and didn't get them.
<p> The most common cause of this problem
is the script dying before sending the complete set of headers, or possibly
any at all, to the server. To
<br> see if this is the case, try running
the script standalone from an interactive session, rather than as a script
under the server. If you get error
<br> messages, this is almost certainly the
cause of the "premature end of script headers" message.
<p> The second most common cause of this
(aside from people not outputting the required headers at all) is a result
of an interaction with Perl's
<br> output buffering. To make Perl flush
its buffers after each output statement, insert the following statements
around the print or write statements
<br> that send your HTTP headers:
<p> {
<br>
local ($oldbar) = $|;
<br>
$cfh = select (STDOUT);
<br>
$| = 1;
<br>
#
<br>
# print your HTTP headers here
<br>
#
<br>
$| = $oldbar;
<br>
select ($cfh);
<br>
}
<p> This is generally only necessary when
you are calling external programs from your script that send output to
stdout, or if there will be a long
<br> delay between the time the headers are
sent and the actual content starts being emitted. To maximize performance,
you should turn
<br> buffer-flushing back off (with $| =
0 or the equivalent) after the statements that send the headers, as displayed
above.
<p> If your script isn't written in Perl,
do the equivalent thing for whatever language you are using (e.g., for
C, call fflush() after writing the headers).
<p> Another cause for the "premature end
of script headers" message are the RLimitCPU and RLimitMEM directives.
You may get the message if
<br> the CGI script was killed due to a resource
limit.
<p>Eugene Sotirescu wrote:
<blockquote TYPE=CITE>William B. wrote:
<br>>
<br>> I'm attempting to setup perlshop and am receiving the above error.
Can anyone
<br>> tell me what it means and how to solve the problem?
<p>What's perlshop?
<p>--
<br>Eugene
<p>"Light is the all-exacting good,
<br>That dry, forever virile stream
<br>That wipes each thing to what it is,
<br>The whole, collage and stone, cleansed
<br>To its proper pastoral."
<br>
Alvin Feinman</blockquote>
<pre>--
Linux Potato...
And not a big in sught!!!</pre>
</html>
--------------95A28A9121A81B8B995526AB--
------------------------------
Date: Tue, 02 Feb 1999 11:46:25 GMT
From: pault2000@my-dejanews.com
Subject: opening files by date
Message-Id: <796oif$rt6$1@nnrp1.dejanews.com>
Hi,
I am having great success with my latest Perl script (partly thanks to people
in this group) but I have come to a dead end.
Basically, I only want files to be opened if they have today's date. I have
just got my head round skipping folders, etc, but I am lost as to how to skip
older files.
Any pointers, help or resources would be greatly appreciated. Below is the
code I am using to skip the folder, etc.
next if ($file =~ /^\.\.?$/);
next if ($file =~ /bak?$/); # Skip . and .. and bak folder
Thanks in advance,
Paul
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 02 Feb 1999 12:37:45 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: opening files by date
Message-Id: <36b6eab6.15965818@news.skynet.be>
pault2000@my-dejanews.com wrote:
>Basically, I only want files to be opened if they have today's date. I have
>just got my head round skipping folders, etc, but I am lost as to how to skip
>older files.
>Any pointers, help or resources would be greatly appreciated. Below is the
>code I am using to skip the folder, etc.
>next if ($file =~ /^\.\.?$/);
>next if ($file =~ /bak?$/); # Skip . and .. and bak folder
You should check up both on the stat() function, and on the -X family of
unary operators.
If you want to skip files that are over 24 hours old, this is easiest
(provided that $file is a valid path, i.e. you can open the file using
that alone):
next if -M $file > 1; # -M = age of last modification in days
If you really need the current date, use stat($file), and check field
#9. Convert it to a date items array using localtime, and see if you get
the same values for items 3, 4 and 5 as you do for today.
@today = localtime($^T); # once (before the loop)
@modified = localtime((stat($file))[9]);
next if grep { $today[$_] != $modified[$_] } (3..5);
Alternatively, you could turn the current time into the format that -M
returns (days, so 1 = 24 hours), and check if -M $file is above that.
HTH,
Bart.
------------------------------
Date: 02 Feb 1999 05:09:29 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: opening files by date
Message-Id: <m1n22xdkae.fsf@halfdome.holdit.com>
>>>>> "pault2000" == pault2000 <pault2000@my-dejanews.com> writes:
pault2000> Basically, I only want files to be opened if they have
pault2000> today's date. I have just got my head round skipping
pault2000> folders, etc, but I am lost as to how to skip older files.
Define "have today's date". If it's the same as "modified within the
last 24 hours", you can use:
next if -M $file > 1;
If it's "modified since midnight today", something like this:
my $today = join ":", (localtime)[3,4,5]; # once before loop
...
next unless $today eq join ":", (localtime((stat($file))[9]))[3,4,5];
As you can tell, the first one is easier. :)
If your definition includes anything with the word "creation" in it,
you won't have an answer. :)
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 02 Feb 1999 13:31:31 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <796unk$qi$1@nnrp1.dejanews.com>
In article <slrn7bb7dl.par.dformosa@godzilla.zeta.org.au>,
dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
> In article <793ibn$8mq$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
> >In article <slrn7b2rg5.fpl.dformosa@godzilla.zeta.org.au>,
> > dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
>
> [...]
>
> >> But if there useable as boolean short cuts then they will be used as
> >> condistionals.
> >
> >
> >Its tougher to do if a language has strict boolean types.
>
> I used to do it in my pascal days, which have strict boolean types.
> On the other hand my binary tree structure was a work of pure
> something. I used an array with a boolean range so a search was
> (pydocode)
>
> while (node->key != target)
> node = node->child[node->key > target]
> endwhile
That does not look like Pascal.
I don't miss those Pascal pointer tree days from college.
(In which I got execellent grades, BTW.)
I was very happy to switch to a table-oriented paradigms
which require much less micromanagement of collections.
>
> To avoid the use of an ifthen stament and needless repeatition of code.
>
> [...]
>
> >Further, many languages must have an assigment statement
> >in order to have a boolean expression:
> >
> > something = this or that;
> >
> >They would not allow for:
> >
> > this or that;
> >
> >as a single statement. Thus, it does not save keystrokes
> >over a good 'if' design.
>
> s=
>
> is quicker then creating a whole ifthen block.
Who said anything about a block?:
if this do that
"do" means that the if statement is only one line and/or
statement (non-blocked).
Unlike ||, it could also be used for While loops,
etc. (Wow, consistancy in syntax!) No blocking required.
Other languages offer ways to do it, but I prefer
an explicit marker such as "do" to indicate that
blocking was not intended.
>
> --
> Please excuse my spelling as I suffer from agraphia. See
> http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
>
>
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 2 Feb 1999 11:43:18 GMT
From: Vit Rudovich <vrudowit@onestone.de>
Subject: Q: Perl in real work.
Message-Id: <36B6E4C7.76343D8F@onestone.de>
Hi!
I seek people used Perl in the real work.
(Developing applications not for research and not as a pilot project
in projects bigger than 6 Man Month
in the team bigger than 2 programmers (full time, not students)
)
I need some information for my study. (Answers to one questionaire
and _samples_of_the_source_code_ ).
If you have any time to help, please send me an e-mail.
Regards!
Vit
--
Vitalij Rudowitsch
vrudowit@onestone.de
http://home.pages.de/~Vit/ArbeitInDeutschland_ru.html
Disclaimer: These opinions are my own and do not reflect those of my
employer.
------------------------------
Date: Tue, 02 Feb 1999 13:18:13 GMT
From: kaz@eudoramail.com
Subject: Question about Regular Expression
Message-Id: <796tue$67$1@nnrp1.dejanews.com>
A part of my CGI get a value of referer. I am trying to take out only the
middle part of each value. Ex. if
http://www.example.com/yyyy/zzzz/index.html, I need only the part of
yyyy/zzzz. Values of directories and page name are different each time
depends on from where people accessed. I tried to use (.*) expression. if
($ddd eq "http://www.example.com/(.*)/index.html")
But it does not recognize each referer.
Then, I used chop command to take out unwanted values. I was able to take out
/index.html part, but I do not know how to take off the beginning
http://www.example.com/ part.
If someone knows how to specify the middle part and knows how to take only
directory names, please help me. If you can use (.*) to specify and can use
it to print the directory names, it would be easy, but I do not know how.
Thank you.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 2 Feb 1999 12:41:53 -0000
From: "Jonathan Tracey" <jont@uk.uu.net.nospam>
Subject: testing if tape loaded in drive
Message-Id: <796rpi$ccl$1@plug.news.pipex.net>
Hi
Does anyone know of a module or otherwise that will allow me to test to see
if a tape has been loaded into a tape drive on an NT machine ?
Cheers
Jon
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4804
**************************************