[10511] in Perl-Users-Digest
Perl-Users Digest, Issue: 4103 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 29 13:06:31 1998
Date: Thu, 29 Oct 98 10:00:21 -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 Thu, 29 Oct 1998 Volume: 8 Number: 4103
Today's topics:
Re: ANN: "pgrep" = perl grep <tchrist@mox.perl.com>
Re: ANN: "pgrep" = perl grep <mcolbert@netgenics.knowspaaaamm.com>
Re: ANN: "pgrep" = perl grep (Ilya Zakharevich)
ANNOUNCE: New Arrival <dgris@rand.dimensional.com>
CGI.pm problems with Xitami Web Server <john@Ihavenomail.com>
Re: changing file timestamp in Win32 (Larry Rosler)
Re: changing file timestamp in Win32 <perlguy@technologist.com>
Re: Comparative modularization (was: Not to start a lan <jddst19@srg.psych.pitt.edu>
Re: Database Search with Perl <mouse@dds.nl>
Re: Funny, no warning!?! <r28629@email.sps.mot.com>
Good PERL Reference material (John Hardy)
Re: Help with Problem in Readdir. <burry@nmt.edu>
Re: Help: Unknown error message <erik@cthulhu.demon.nl>
Re: Not to start a language war but.. <zenin@bawdycaste.org>
Re: Not to start a language war but.. <zenin@bawdycaste.org>
Re: Parsing large text file (TIA) (Larry Rosler)
Re: Perl & Y2K - booby trap code (Abigail)
Re: Perl & Y2K - booby trap code (Abigail)
Re: Perl & Y2K - booby trap code <uri@sysarch.com>
Re: Perl & Y2K - booby trap code (Ilya Zakharevich)
Re: Perl & Y2K - booby trap code (Ilya Zakharevich)
Re: Perl & Y2K - booby trap code <zenin@bawdycaste.org>
Re: Perl Setup: (Why 'use' statement gives =>not found) <rootbeer@teleport.com>
Re: Perl vs ASP in MS IIS 4.0 (Larry Rosler)
Re: Perl vs ASP in MS IIS 4.0 <uri@sysarch.com>
pl2exe - disappearing result <zeller@indiana.edu>
Replace pattern on multiple files? (John Robson)
Why is perl better than shell scripting language? <yong@shell.com>
Win95 Script Mapping <john@Ihavenomail.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Oct 1998 16:23:13 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ANN: "pgrep" = perl grep
Message-Id: <71a4ph$1i4$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.moderated,
sb@engelschall.com (Steffen Beyer) writes:
:(Posting did not appear on machine where first posted, therefore reposting.)
:
: =======================
: "pgrep" - perl grep
: =======================
:
:Did you ever want to have a "grep" combined with the power of Perl's
:regular expressions?
Why yes. And that's why I years and years ago wrote tcgrep,
which is in my scripts directory on CPAN and in PCB.
--tom
--
*** The previous line contains the naughty word "$&".\n
if /(ibm|apple|awk)/; # :-)
--Larry Wall in the perl man page
------------------------------
Date: Thu, 29 Oct 1998 16:44:25 GMT
From: MBC <mcolbert@netgenics.knowspaaaamm.com>
Subject: Re: ANN: "pgrep" = perl grep
Message-Id: <3638AA0B.A795E9F@netgenics.knowspaaaamm.com>
hey, cool! now there's (at least) "more than one way to do it!"
Tom Christiansen wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.moderated,
> sb@engelschall.com (Steffen Beyer) writes:
> :(Posting did not appear on machine where first posted, therefore reposting.)
> :
> : =======================
> : "pgrep" - perl grep
> : =======================
> :
> :Did you ever want to have a "grep" combined with the power of Perl's
> :regular expressions?
>
> Why yes. And that's why I years and years ago wrote tcgrep,
> which is in my scripts directory on CPAN and in PCB.
>
> --tom
> --
> *** The previous line contains the naughty word "$&".\n
> if /(ibm|apple|awk)/; # :-)
> --Larry Wall in the perl man page
------------------------------
Date: 29 Oct 1998 17:57:36 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: ANN: "pgrep" = perl grep
Message-Id: <71aaag$o2g$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <71a4ph$1i4$1@csnews.cs.colorado.edu>:
> :Did you ever want to have a "grep" combined with the power of Perl's
> :regular expressions?
>
> Why yes. And that's why I years and years ago wrote tcgrep,
> which is in my scripts directory on CPAN and in PCB.
Do not miss pfind too. Though modeled after `find', it has enough
strength to behave like `grep' too. Now with interactive mode too!
All with 5 switches and 5 convenience functions name.
Ilya
------------------------------
Date: Thu, 29 Oct 1998 17:04:22 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: ANNOUNCE: New Arrival
Message-Id: <m3g1c7s454.fsf@rand.dimensional.com>
Hannah Elizabeth Grisinger entered the world at
5:45 am, 29 October 1998. She weighed 6 lbs, 15 ozs.
and was 19 inches long.
Mother and daughter are recuperating in the hospital,
father is delirious with joy :-).
dgris
--
Daniel Grisinger dgris@rand.dimensional.com
Supporter of grumpiness where grumpiness is due on clpm.
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 29 Oct 1998 17:41:03 GMT
From: "John Reynolds" <john@Ihavenomail.com>
Subject: CGI.pm problems with Xitami Web Server
Message-Id: <01be0362$1cbed7a0$07221ca5@B19592-WS.kcc.com>
Hello,
My platform is Win95, Xitami 2.4a, Perl 5.004_02 (by Gurusamy Sarathy),
CGI.pm 2.32.
I can run simple CGI programs that use only core Perl (e.g. print
"Content-type: text/html\n\nHowdy\n" ; ). In a case like this, there are no
additional DOS windows started on the server for Perl to run. Output is
sent
correctly back to the browser.
Here's a sample program using CGI.pm:
#!/usr/bin/perl -w
use CGI ':standard' ;
print header('text/plain'),"Nothing to it!" ;
When this is run, I first get a window on the server saying File Download,
Temporary Folder. Next I get a DOS window that indicates a syntax error on
line 1 near "it!". This program does run correctly from the command line
which indicates that CGI.pm is installed and is being loaded by Perl. I've
tried using #!perl and get the same results.
TIA for any help!
-- John
------------------------------
Date: Thu, 29 Oct 1998 08:05:29 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: changing file timestamp in Win32
Message-Id: <MPG.10a232243e3b82c49898ec@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a DIScourtesy copy mailed.]
In article <laaf2f8qwn.fsf@erh.ericsson.se> on 29 Oct 1998 13:59:52
+0100, Michal Rutka <erhmiru@erh.ericsson.se> says...
> stevenfitz@my-dejanews.com writes:
> > I am writing a small Win32 Perl script ...
...
> > ... Any thoughts on what I'm doing wrong or how I could do
> > this better?
>
> You are using Win32. This is wrong. If you want to do it better switch to
> some decent operating system.
<FLAME>
This answer is worse than content-free. It is degrading to the
submitter (and to many others who use software that happens to run more
than 90% of the world's computers). It is unprofessional in the
extreme, no longer funny in the least, and unworthy of bandwidth in this
newsgroup.
I, for one, will protest here against such puerile behavior until it is
stamped out. Anyone else who cares at all about the future of Perl or
of the reputation of Perl professionals should do the same.
</FLAME>
I tried to help the submitter two days ago by suggesting he check the
return value of 'utime' and $!. Guess what -- just like on a 'decent
operating system'. I haven't seen a response.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 29 Oct 1998 17:09:50 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: changing file timestamp in Win32
Message-Id: <3638A15E.20789F3D@technologist.com>
Michal Rutka wrote:
>
> stevenfitz@my-dejanews.com writes:
> <...>
> > I am writing a small Win32 Perl script to synch two directories and find that
> <...>
> > utime ($newTime, $newTime, $dest_path);
> <...>
> > It doesn't seem to matter what I set $newTime to, utime always seems to set
> > it
> > to the current time. Any thoughts on what I'm doing wrong or how I could do
> > this better?
>
> You are using Win32. This is wrong. If you want to do it better switch to
> some decent operating system.
>
> > Thanks,
> > Steven
>
> Regards,
>
> Michal.
Stop with the "my OS is better than your" bullshit. We are going to end
up with another useless "Perl v. Python" -type battle.
Any OS that can run Perl is OK with me!
Steven,
I just tried the following code without any problem:
$when = time() + 100000 * 60;
$filename= "c:/telnet.txt";
utime ($when,$when,$filename) || die "ERROR $!\n";
So either the OS you are on (you didn't specify) doesn't support it, I
am on NT but haven't tried it on '95 or '98.
OR
There is a problem with the file you are trying to modify. Add the
"die" onto the end and it should give you an error message if there is a
problem...
Good luck!
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Thu, 29 Oct 1998 12:15:55 -0500
From: "John Duncan" <jddst19@srg.psych.pitt.edu>
Subject: Re: Comparative modularization (was: Not to start a language war but..)
Message-Id: <71a7m8$ous$1@usenet01.srv.cis.pitt.edu>
>> Odd how you can say something pertinent and impertinent simultaneously.
:-)
>
>Actually, that should be "pertinent and impertinently," no?
>
no. :):)
------------------------------
Date: Thu, 29 Oct 1998 17:03:06 +0100
From: "Mouse" <mouse@dds.nl>
Subject: Re: Database Search with Perl
Message-Id: <71a3k2$k74$1@thunderstorm.netnews.de>
I have done this using the module WIN32::ODBC.
For more info check out the WIN32::ODBC Homepage at
http://www.roth.net/odbc/
Good luck!
fcga@my-dejanews.com wrote in message <717pju$15e$1@nnrp1.dejanews.com>...
>I'd like to obtain some information on how to do a perl program that
searchs
>a database created with Access97. The search could be costumized by me
>because my database has a lot of tables to search on. Please, could someone
>help me? Thank You
>
>Felipe
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 29 Oct 1998 10:36:44 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Funny, no warning!?!
Message-Id: <3638999C.75D5A882@email.sps.mot.com>
Bart Lateur wrote:
>
> I stumled across this; I think it's strange that I don't get a warning.
>
> Try this (provided a subdirectory "html" does indeed exist):
>
> #! perl -w
> opendir(HTML,"./html") or die "Can't open directory: $!";
> @file = grep { /\.html?$/ } readdir(DIR);
Even use strict didn't help in this situation, as least when I tried.
> closedir(DIR);
closedir(DIR) or die "can't close directory\n"; # should die here
> $files = @file;
> print STDERR "This is perl $]";
> foreach $file (@file) {
> print STDERR "File = $file\n";
> open(HTML,"./html/$file");
> }
I would recommend you use the standard module DirHandle, as I always do,
which would take care of the 'no-a-valid-dir-handler' problem.
-tk
------------------------------
Date: Thu, 29 Oct 1998 15:49:30 GMT
From: jhardy@cins.com (John Hardy)
Subject: Good PERL Reference material
Message-Id: <e80_1.344$%Z6.584374@198.235.216.4>
Need some help with PERL. I found a good resource for
beginners
http://www.extropia.com/faq/perl_faq.html
------------------------------
Date: Thu, 29 Oct 1998 09:29:29 -0700
From: Brent Perschbacher <burry@nmt.edu>
To: Knight <knight_storm@usa.net>
Subject: Re: Help with Problem in Readdir.
Message-Id: <Pine.SUN.3.96.981029092752.29144A-100000@rainbow>
On Wed, 28 Oct 1998, Knight wrote:
You might want to check the permissions on the file after you download it.
They may be changed so that ftp users can't modify them. When you rename
the file it is probably reseting the permissions.
Burry
> I am running perl on win95 and have created a program that opens a directory
> and it's subdirectories, reads them, them creates a html page with links to
> any files of a specified type. The problem is that when I download a binary
> file through ftp, such as a jpg or gif, and run this program on the
> directory which contains that file, it is not recognized. (It is not listed)
> other files in the directory are. Then when I rename the file it is
> recognized. Why does this happen and how can I fix it?
>
> -with thanks
> Knight
>
>
>
>
"To deny who I was is to deny who I am."
--Darius
------------------------------
Date: Thu, 29 Oct 1998 11:02:16 -0500
From: Erik van Roode <erik@cthulhu.demon.nl>
Subject: Re: Help: Unknown error message
Message-Id: <36389188.5263EF5E@cthulhu.demon.nl>
Aidan Rogers wrote:
>
> I'm getting an error message that isn't documented in the
> Camel Book:
>
> Can't locate loadable object for module Date::DataCalc in
> @INC (@INC includes ....)
> use Date::DateCalc;
> Does anyone have any ideas as to why this might be happening?
Note the difference between DataCalc and DateCalc ...
The error message states that module Date::DataCalc is not in @INC.
Your example tries to use Date::DateCalc. You sure you didn't make
a spelling error?
------------------------------
Date: 29 Oct 1998 16:48:34 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Not to start a language war but..
Message-Id: <909679684.321163@thrush.omix.com>
John Porter <jdporter@min.net> wrote:
>snip<
: @Widget::ISA = ('Frob');
: sub Widget::new { bless {} }
:
: 'package' doesn't actually relate to Perl's OO in any special way;
: it just changes the default namespace for any following unqualified
: declarations.
It also affects the single argument form of bless() in ways that
will make the above example fail:
$ perl
@Widget::ISA = ('Frob');
sub Widget::new { bless {} }
my $widget = new Widget;
print ref $widget;^D
main
Since the object is now blessed into package main::, it will never
search @Widget::ISA to find Frob or borrow any of Frob's methods.
Better to code that constuctor:
sub Widget::new { bless {}, shift }
--
-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: 29 Oct 1998 16:40:11 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Not to start a language war but..
Message-Id: <909679180.381062@thrush.omix.com>
Abigail <abigail@fnx.com> wrote:
: Zenin (zenin@bawdycaste.org) wrote on MDCCCLXXXV September MCMXCIII in
: <URL:news:909623452.948196@thrush.omix.com>:
>snip<
: ++ Name a platform Python supports that Perl doesn't, I dare you.
: ++ However I'd be surprised if I couldn't name a few that Perl
: ++ supports but Python doesn't.
:
: Well, arguebly, the Mac. While Python was developped on the Mac, no
: official version of Perl ran on the Mac. There have been separate ports to
: the Mac, but that's all. I'd be surprised to see a Mac version of 5.005.
First you claim the Mac as a non-Perl enabled system, then you go
on to invalidate yourself by saying that yes there is a port to
the Mac. So, which is it?
>snip<
: ++ Perl has had exceptions for dog years, before it even had
: ++ OO. We just call try, throw, and catch "eval", "if", and "die"
: ++ respectively:
:
: If you claim Perl has had exceptions for dog years, don't come with
: a spiffy OO example which has only been there since 5.005 - and then
: as an undocumented experimental feature.
eval {
die ('boom');
};
if ($@) {
die "I went $@";
}
Works quite nicely under perl 4, and I think 3 (though I don't have
a copy to try off hand).
: And don't use // style comments. They don't work that well in Perl.
My bad... I'v been working with that Java thing too much...
>snip<
: ++ I was writing C extensions in Perl 20 minutes from the moment I
: ++ started reading the perlxstut man page, and I'm far from the C
: ++ expert. Perl has also been embedable for likely longer then
: ++ Python has existed.
:
: You must be an exception, and you don't hear people often claim XS
: is easy. Perhaps you are the person who could write a good tutorial
: about XS then?
I thought I just gave testimonial of perlxstut already being
a good tutorial.
>snip<
: ++ Please show me how the readability of this code would be helped by
: ++ either indent style blocks or max 80 column text. Give me a couple
: ++ minutes and I'm sure I could dig up a couple dozen Perl and C
: ++ examples as well.
:
: Oh, that's easy:
:
: public StringBuffer append (boolean bool) {
: _extractStringBuffer().append (bool);
: type = STRING;
: return string;
: }
Now do that 12 times in a row (ala my example), and it isn't so
pretty.
: Code with lines over 80 chars always lose when it comes to readability.
Balderdash.
--
-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: Thu, 29 Oct 1998 08:24:58 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Parsing large text file (TIA)
Message-Id: <MPG.10a236b72f095ff9898ee@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <719sna$bf$2@shadow.skypoint.net> on 29 Oct 1998 14:05:30
GMT, Jamie Hoglund <jhoglund@mirage.skypoint.net> says...
...
> I *think* you can screw around with the $/ variable. (or is it $\ I can't
> remember)
Shouldn't you find out which *before* you waste our time?
> $\ = "\nPersonID";
Wrong, it's the other one.
> The each $record = <FILE>;
>
> will be a complete paragraph, and you'll have to manually split out the
> \n's: @lines = split(/\n/,$record);
>
> Be careful, messing around with the new line variable will break nearly
> everything else if it isn't restored.
That's why Perl programmers localize the change within a block. Learn
how!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 29 Oct 1998 16:13:53 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <71a481$76h$1@client3.news.psi.net>
Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXXXV September MCMXCIII in
<URL:news:MPG.10a19f236694c4b19898ea@nntp.hpl.hp.com>:
++ [Posted to comp.lang.perl.misc and copy mailed.]
++
++ In article <718sv6$ctn$3@client3.news.psi.net> on 29 Oct 1998 05:03:34
++ GMT, Abigail <abigail@fnx.com> says...
++ > Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXXXIV September MCMXCIII in
++ > <URL:news:MPG.10a148746fb84072989845@nntp.hpl.hp.com>:
++ > ++ The range of 'tm_sec' is (correctly) 0 to 59, instead of the 60 or 61
++ > ++ that was sneaked into the C Standard later by 'clever' people.
++ >
++ > I disagree that 0 .. 59 is correct. 61 is of course pure silliness,
++ > but what do you expect from those who gave us year - 1900?
++
++ As has been discussed, no minute in the Unix epoch time scale can have
++ 61 seconds, because by fiat (the POSIX Standard) no cognizance is taken
++ of leap seconds. So astronomical time and POSIX time drift very slowly
++ apart, but our calculations of time intervals are sane and simple.
Yes, that's true. I forgot that leap seconds are ignored hence Dec 31
23:60 will never happen. (Even with leap seconds, 23:61 will not happen)
Unless you can set a date/time with 23:60 as time, but that's far fetched.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
------------------------------
Date: 29 Oct 1998 16:25:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <71a4t3$7cq$1@client3.news.psi.net>
David Formosa (dformosa@zeta.org.au) wrote on MDCCCLXXXV September
MCMXCIII in <URL:news:slrn73gjrn.vvh.dformosa@godzilla.zeta.org.au>:
++ In article <718sv6$ctn$3@client3.news.psi.net>, Abigail wrote:
++
++ [...]
++
++ >I disagree that 0 .. 59 is correct. 61 is of course pure silliness,
++ >but what do you expect from those who gave us year - 1900?
++
++ What about leap seconds?
Leap seconds happen at 23:60.
However, as Larry (the other one...) pointed out, UNIX time ignores
leap seconds, and hence 0 .. 59 is correct.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 29 Oct 1998 11:53:33 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <x7n26fe2cy.fsf@sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> Command line:
LR> perl -we '...' (correct) is not the same as perl -ew '...'
LR> (wrong). In this respect, Perl command-line processing differs
LR> from the Unix norm, in which any number of single-letter
LR> no-argument options may be mixed with one single-argument option,
LR> in any order.
what do you mean by -e taking no argument? -e takes the next argument as
perl code. so -ew is trying to execute 'w'. nothing about this differs
from the unix norm. it is not the same as the filename args at the end
of the option list. the code string *IS* the arg to -e. this is document
just fine. it behaves the same as with -i needing to be put at the end
of single letter option groups so it either get a null suffix or the one
you want.
LR> grep -f => readdir DIR; returns all the entries in the directory,
LR> not just the files, because the => operator 'forces any word to
LR> the left of it to be interpreted as a string' (from perlop). So
LR> the grep is for '-f', which is TRUE. But '-f' is not a word, it
LR> is an operator. Perl defines a 'word' as a string that matches
LR> /^\w+$/. See perlre: '\w Match a "word" character (alphanumeric
LR> plus "_") ... To match a word you'd need to say \w+.' But perl
LR> doesn't seem to think so.
that is more a bug IMO. i dislike the implied quoting of => anyway and i
try not to use it. and the recent use of it outside of hash data is
disquieting. it may look cuter but it has semantic affects that ','
doesn't have.
LR> $n = tr/x//; counts the number of 'x's in $_, the same as tr/x/x/;
LR> To delete them, one must say tr/x//d;
this comes from the unix tr command where the semantics are the
same. the second string is optional in the command tr which duplicates
the first string. translation only occurs if you have a second
string. but deletion and squeezing can happen either way. the perl
syntax requires tr/// so to make a null second string you need the
tr/x//. if you were counting (or squeezing or deleting) complex lists of
chars would you want to do tr/complex list/complex list/? larry chose
to keep similar semantics for ease of learning if you knew the languages
perl was derived from.
i sympathize with your need to count regex matches but /g already has a
meaning in a scalar context that was used often. the () trick is ugly,
but i wonder why people need to count matches without getting them? and
what is wrong with the simple 1 line while loops to do it?
i don't deny there are gotme's. yesterday i was stuck trying to get a
slice from a hash ref. i have done this before but the syntax flew out
of my brain. it took a little while longer than i wanted to get it
right. that is my most recent gotme.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 29 Oct 1998 17:49:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <71a9r4$nk4$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Uri Guttman
<uri@sysarch.com>],
who wrote in article <x7n26fe2cy.fsf@sysarch.com>:
> that is more a bug IMO. i dislike the implied quoting of => anyway and i
> try not to use it.
But perl has a convenient non-quoting version of =>, why not use it?
Ilya
------------------------------
Date: 29 Oct 1998 17:48:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <71a9p1$nim$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.10a1cabddb5f04a79898eb@nntp.hpl.hp.com>:
> Operators:
>
> grep -f => readdir DIR; returns all the entries in the directory,
> not just the files, because the => operator 'forces any word to
> the left of it to be interpreted as a string' (from perlop). So
> the grep is for '-f', which is TRUE. But '-f' is not a word, it
> is an operator. Perl defines a 'word' as a string that matches
> /^\w+$/. See perlre: '\w Match a "word" character (alphanumeric
> plus "_") ... To match a word you'd need to say \w+.' But perl
> doesn't seem to think so.
It does. The word quoted by => is 'f'.
> perl -le "print -'foo'"
-foo
Hope this helps,
Ilya
------------------------------
Date: 29 Oct 1998 17:11:16 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <909681046.887904@thrush.omix.com>
Uri Guttman <uri@sysarch.com> wrote:
>snip<
: i sympathize with your need to count regex matches but /g already has a
: meaning in a scalar context that was used often. the () trick is ugly,
: but i wonder why people need to count matches without getting them?
A "hit score" for a search engine perhaps?
: and what is wrong with the simple 1 line while loops to do it?
Nothing.
: i don't deny there are gotme's. yesterday i was stuck trying to get a
: slice from a hash ref. i have done this before but the syntax flew out
: of my brain. it took a little while longer than i wanted to get it
: right. that is my most recent gotme.
Many people seem to have similar problems. Coming from a strong
shell background, it just kind of makes sense to me I guess.
It does help to always be thinking of how you *want* the data,
and not how the data is stored. If you want a single value its
got a $, want a list its got an @, etc. This rule applies
regardless of the "real" type.
--
-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: Thu, 29 Oct 1998 16:12:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl Setup: (Why 'use' statement gives =>not found)
Message-Id: <Pine.GSO.4.02A.9810290811390.3421-100000@user2.teleport.com>
On Thu, 29 Oct 1998 devonc1061@my-dejanews.com wrote:
> At runtime I get a
> use: not found
Have you seen this entry from perldiag? Hope this helps!
=item %s: not found
(A) You've accidentally run your script through the Bourne shell
instead of Perl. Check the #! line, or manually feed your script
into Perl yourself.
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 29 Oct 1998 08:17:04 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl vs ASP in MS IIS 4.0
Message-Id: <MPG.10a234da356acb419898ed@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <36385506.E5AEDAE1@technologist.com> on Thu, 29 Oct 1998
11:44:06 GMT, Brent Michalski <perlguy@technologist.com> says...
! IamInNet wrote:
! > Can anybody give me any comparisons between Perl vs ASP in MS IIS
4.0?
! > (Speed, scalability, stability, etc)
...
! I was recently asked to work on a small web application that connected
! to an Access database. It was written in ASP.
!
! The ASP code was 4-1/2 pages long and VERY hard to follow, even though
I
! DO know ASP pretty well. I decided to convert it to Perl using the
DBI
! and DBD:ODBC modules.
!
! The resulting page was 1 page long, very readable, easy to follow, and
I
! had many more capabilities to work with the data with Perl rather than
! ASP.
!
! For me, there is no question what is better to use. The choice
though,
! is up to you. If you are an ASP guru and like how it works, use it.
! Personally, I find Perl a much better language to use for writing web
! applications.
<SARCASM>
Oh, Brent, what are you doing promoting Perl in MS IIS 4.0? Follow
Michal Rutka's advice, and tell them to get a 'decent operating system'.
</SARCASM>
OK, the coincidence of this intelligent response by a Perl Evangelist
coming up right after my blast to a Perl Unprofessional was too much to
resist. Enough, already!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 29 Oct 1998 12:01:41 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl vs ASP in MS IIS 4.0
Message-Id: <x7k91je1ze.fsf@sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> In article <36385506.E5AEDAE1@technologist.com> on Thu, 29 Oct 1998
LR> 11:44:06 GMT, Brent Michalski <perlguy@technologist.com> says...
LR> ! IamInNet wrote:
LR> ! > Can anybody give me any comparisons between Perl vs ASP in MS IIS
LR> 4.0?
LR> ! > (Speed, scalability, stability, etc)
LR> <SARCASM>
LR> Oh, Brent, what are you doing promoting Perl in MS IIS 4.0? Follow
LR> Michal Rutka's advice, and tell them to get a 'decent operating system'.
LR> </SARCASM>
<PLUG>
well, i hate to help out any POB but my wallet is driving me to say
this. my company's product fast.serv will greatly (5-20x) speed up your
cgi (perl, c or tcl) with IIS. it is a plugin that uses the fastcgi
protocol to reduce cgi startup time due to forks, perl compilation, db
connections etc. check out http://www.fastengines.com (from where i have
been doing most of my posting recently) for a free 30 trial copy.
</PLUG>
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Thu, 29 Oct 1998 11:43:51 -0500
From: Tom Zeller <zeller@indiana.edu>
Subject: pl2exe - disappearing result
Message-Id: <36389B47.F72143DB@indiana.edu>
Under NT the perl script:
@ret=`c:\\winnt\\system32\\adtools\\net.exe use`;
print @ret;
works when run as a perl script (5.005). however when an exe is made
with pl2exe, @ret has null values. Anyone know why?
p.s. the reason i'm doing this script is to prevent "net sends" but
allowing other use of the net.exe command.
Tom Zeller
Indiana University
zeller@indiana.edu
------------------------------
Date: 29 Oct 1998 16:07:20 GMT
From: as646@FreeNet.Carleton.CA (John Robson)
Subject: Replace pattern on multiple files?
Message-Id: <71a3ro$sjf@freenet-news.carleton.ca>
I would like to do pattern matching and replacing on all files under a
directory. No, I'm not asking people to give me the full script although
that would be nice. I have read the FAQ. I know how to use regexp, how
to open, write to and close file. But how do I put all of this together?
How do I attack this problem in Perl ?
Can someone outline a plan of attack and solution in terms of Perl ?
(P.S. If it matters, I use Perl on DOS/Windows95)
Thanks!
------------------------------
Date: Thu, 29 Oct 1998 10:44:35 -0600
From: yong <yong@shell.com>
Subject: Why is perl better than shell scripting language?
Message-Id: <36389B72.B44768B0@shell.com>
I used to do quite a bit shell scripting (C/Bourne/Korn). Now most of
that kind of work is done in Perl. Other than better regex functionality
which we have to use extensively, I think one important reason is that
Perl error messages are much clearer. When you have an error in shell
language, you get (e.g.) "Syntax error". That's it. But Perl says more.
Secondly, There're fewer places you have to care about white space in
your Perl script. Offhand I can only think of the "print $a x 10"
construct. But in Bourne shell, you must use space in parentheses like
in "if ( $a == $b)". IMHO, any language that requires special attention
to spaces in source code is bad. (Fortran, not sure about Fortran 90,
even requires the starting position of a statement line.)
There's one situation I can think of I have to use the shell language,
that is when I want to change the environment variables of the parent
process.
Any comments are welcome.
Yong
------------------------------
Date: 29 Oct 1998 17:45:52 GMT
From: "John Reynolds" <john@Ihavenomail.com>
Subject: Win95 Script Mapping
Message-Id: <01be0362$c8fc2a40$07221ca5@B19592-WS.kcc.com>
Hello,
Does anyone know how to make Win95 run a perl script from a DOS window
without having to preface the script with perl each time? (e.g. "perl
scriptName.pl" works, "scriptName.pl" alone does not).
I've seen a fix for NT that requires a change to the registry to map a file
extension to an executable. I have associated the ".pl" extension to perl
in Win Explorer but that does not translate to the DOS prompt.
TIA for any help!
-- John
------------------------------
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 4103
**************************************