[10471] in Perl-Users-Digest
Perl-Users Digest, Issue: 4063 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 24 20:04:44 1998
Date: Sat, 24 Oct 98 17:00:18 -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 Sat, 24 Oct 1998 Volume: 8 Number: 4063
Today's topics:
Re: *Why* does clpm attract non-perl posts? (Amitai Schlair)
comp.lang.perl.win32 [again] <dgris@rand.dimensional.com>
Re: deadlock with flock() and open() (Abigail)
Error (TipTup JHA&HHA)
Formating Dollar Amount <chi@cybie.com>
Re: Formating Dollar Amount <rick.delaney@shaw.wave.ca>
Re: Formating Dollar Amount (Matthew Bafford)
Re: Formating Dollar Amount <r28629@email.sps.mot.com>
Re: How can I get a list of OS processes from Perl on N <ram.r.varra@intel.com>
Re: Lexical scoping with foreach () {} continue {} <zenin@bawdycaste.org>
Re: Net::Ping WON'T WORK!!!!! <nkolb@htl.de>
Re: Newbie help--perl won't run as CGI (Bob N.)
Re: Newbie help--perl won't run as CGI <mjohnson@getonthe.net>
Re: Not to start a language war but.. <tchrist@mox.perl.com>
Re: Not to start a language war but.. (Michael J Gebis)
Re: Perl & Y2K - booby trap code (Larry Rosler)
Re: Perl & Y2K - booby trap code (Larry Rosler)
Re: Perl & Y2K - booby trap code (Abigail)
Re: Perl scripts under NT, something not right here. <mjohnson@getonthe.net>
Re: Perl under IIS 4.0? <mjohnson@getonthe.net>
PLEASE HELP SOON!!! <bast2657@sssnet.com>
Re: Problems with plus sign in perl script <bertilow@algonet.se>
Using MS-Access with OLE <lynn@swcp.com>
Re: What isn't Perl good for? (Michael Lewchuk)
Re: why use do BLOCK? <zenin@bawdycaste.org>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 24 Oct 1998 19:37:31 -0400
From: amitai.schlair@usa.net (Amitai Schlair)
Subject: Re: *Why* does clpm attract non-perl posts?
Message-Id: <1dheu37.1f55lh2l4k8asN@francisco.amitai.org>
David Alan Black <dblack@pilot.njin.net> wrote:
> What I don't get is.......
>
> If someone is interested in CGI programming and/or Web administration
> and/or the vagaries of Micros**t IE, etc., why wouldn't that person
> actually WANT to participate in the appropriate newsgroups?
Because Perl is, above all else, a glue language.
New Perl users, like the rest of us clpm readers, are almost always
trying to fit lots of pieces together with Perl. The difference between
us and them: new users don't make the effort to determine -- or simply
don't know -- whether their problem is in fact with one or more of the
various bits of wood, spackle, masking tape, metal, grease, etc.
I imagine the same effect can be seen in the Tcl and Python newsgroups,
only to a lesser degree (in proportion to the number of newbies who've
heard about them).
Not that I like this trend either.
- Amitai
--
The man who reads nothing at all is better educated than the man who
reads nothing but newspapers.
-- Thomas Jefferson
------------------------------
Date: Sat, 24 Oct 1998 21:07:13 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: comp.lang.perl.win32 [again]
Message-Id: <m3n26l3cmp.fsf@rand.dimensional.com>
Would anyone interested in helping write an RFD for
comp.lang.perl.win32 please contact me (via e-mail,
not on clpm; we don't really need to clog clpm with
this).
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: 24 Oct 1998 23:26:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: deadlock with flock() and open()
Message-Id: <70tno3$je$1@client3.news.psi.net>
Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCCLXXIX September
MCMXCIII in <URL:news:70qh30$iqk$1@csnews.cs.colorado.edu>:
++ [courtesy cc of this posting sent to the despammed address to cited author via email]
++
++
++ But it doesn't matter. If process number one says "lock A, then lock B",
++ but process number two says "lock B, then lock A", you're really going
++ to have a problem. You cannot acquire two separate lock atomically,
++ so you'll always be vulnerable to errors in ordering. You must reduce
++ these to one lock.
++
++ Suggestion: lock only a dummy third file, something of a sentinel,
++ before attempting to access without locks the first two.
++
++ There's a reason that universities offer courses in operating systems
++ and concurrency design, you know. :-)
True to a certain extent. It only works if you can both programs.
Often you cannot. Or you cannot know in which order files are
locked, because it depends on external parameters.
A trivial, contrieved, example. A program opens a file, locks it,
reads the file, and for every file name found, it opens and locks
that file. The program is smart enough to keep a graph and detect
cycles, so it won't self deadlock if there are files A and B, where
A contains B and B contains A.
Now we run two instances of the program simultaniously; one starts
with file A, the other with file B.
Its a common problem in databases. One process locks table A (or just
a page) then table B. Then another process comes in and locks B first,
then table A. Using a third, global, lock would reduce database managers
to silly DOS applications. There's a reason multiple processes can
exist on certain OSses.
Abigail
--
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
${qq$\x5F$} = q 97265646f9 and s g..g;
qq e\x63\x68\x72\x20\x30\x78$&eggee;
{eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
------------------------------
Date: Sat, 24 Oct 1998 16:38:33 -0600 (MDT)
From: TipTup@webtv.net (TipTup JHA&HHA)
Subject: Error
Message-Id: <25467-363256E9-58@newsd-112.bryant.webtv.net>
I'm sort of new to perl...........
Heres the error I got:
Can't modify logical and in scalar assignment at
/data1/hypermart.net/nettv/mirc/test.pl line 55, near ""yes") " syntax
error at /data1/hypermart.net/nettv/mirc/test.pl line 243, near "print"
Execution of /data1/hypermart.net/nettv/mirc/test.pl aborted due to
compilation errors.
[Sat Oct 24 18:33:56 1998] access to
/data1/hypermart.net/nettv/mirc/test.pl failed for 207.79.35.58, reason:
Premature end of script headers
Anyways what I did is earlier in the script I put this:
$admin = "no";
then later in the script if password eq password
I typed this:
$admin = "yes";
which generated the errors above.......
any suggestions?
------------------------------
Date: Sat, 24 Oct 1998 14:39:35 -0700
From: Chi Yu <chi@cybie.com>
Subject: Formating Dollar Amount
Message-Id: <36324917.D4061D6C@cybie.com>
Greetings,
How can I format a variable length number (no decimals) into a display
format using the dollar sign and commas such as $n,nnn,nnn, $n,nnn, etc?
Must I write a routine or is there already a predefined format using
sprintf? If there is, I can't find any documentation explaining it.
Can someone please send me a code snippet? Thanks!
Chi Yu
------------------------------
Date: Sat, 24 Oct 1998 21:49:16 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Formating Dollar Amount
Message-Id: <36324CFD.55A77924@shaw.wave.ca>
[posted & mailed]
Chi Yu wrote:
>
> Greetings,
>
> How can I format a variable length number (no decimals) into a display
> format using the dollar sign and commas such as $n,nnn,nnn, $n,nnn,
> etc?
perlfaq5, "How can I output my numbers with commas added?"
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 24 Oct 1998 17:48:56 -0400
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Formating Dollar Amount
Message-Id: <MPG.109c1556dc0ad95b9896e3@news.scescape.net>
In article <<36324917.D4061D6C@cybie.com>>, chi@cybie.com (Chi Yu)
pounded the following:
=> Greetings,
=>
=> How can I format a variable length number (no decimals) into a display
=> format using the dollar sign and commas such as $n,nnn,nnn, $n,nnn, etc?
=>
=> Must I write a routine or is there already a predefined format using
=> sprintf? If there is, I can't find any documentation explaining it.
=>
=> Can someone please send me a code snippet? Thanks!
=>
=> Chi Yu
% perldoc perlfaq5
[snip]
How can I output my numbers with commas
added?
This one will do it for you:
sub commify {
local $_ = shift;
1 while s/^(-?\d+)(\d{3})/$1,$2/;
return $_;
}
$n = 23659019423.2331;
print "GOT: ", commify($n), "\n";
GOT: 23,659,019,423.2331
You can't just:
s/^(-?\d+)(\d{3})/$1,$2/g;
because you have to put the comma in and then recalculate your
position.
Alternatively, this commifies all numbers in a line regardless of
whether they
have decimal portions, are preceded by + or -, or whatever:
# from Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
sub commify {
my $input = shift;
$input = reverse $input;
$input =~ s<(\d\d\d)(?=\d)(?!\d*\.)><$1,>g;
return reverse $input;
}
[snip]
%
--Matthew
------------------------------
Date: Sat, 24 Oct 1998 17:08:47 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Chi Yu <chi@cybie.com>
Subject: Re: Formating Dollar Amount
Message-Id: <36324FC5.7FA4D7B2@email.sps.mot.com>
[posted and copy emailed]
Chi Yu wrote:
> Can someone please send me a code snippet? Thanks!
Nope, but you can look it up yourself:
perldoc -q commas
-tk
------------------------------
Date: Sat, 24 Oct 1998 16:08:24 -0700
From: "Ram Varra" <ram.r.varra@intel.com>
Subject: Re: How can I get a list of OS processes from Perl on NT
Message-Id: <70sv4c$lss$1@scnews.sc.intel.com>
Try NT Resource kit commands 'PSTAT.EXE'.
Miroslav Dzakovic > wrote in message <70pt1r$ghu$1@scnews.sc.intel.com>...
>Hello,
>
>if it was Perl running on Unix, I'd use 'ps' system command to look all
>process id's on the system, or to ask for a specific one.
>
>Is there anything similar to this I can use on NT?
>
>Thank you.
>
>
>
------------------------------
Date: 24 Oct 1998 22:01:10 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Lexical scoping with foreach () {} continue {}
Message-Id: <909266505.983337@thrush.omix.com>
Paul Makepeace <Paul.Makepeace@POBox.com> wrote:
: (Next point) I'm a great fan of generally defining variables at the lowest
: scope I can get away with. I hate defining them outside loops. So I was
: disappointed when I noticed:
:
: foreach my $item (1..3) {
: my ($stuff, @more_stuff, %etc);
:
: # vast amounts of processing
:
: } continue {
: # $item is in lexical scope but
: # $stuff and friends aren't
: }
:
: It makes sense of course, it's just a shame for the above idiom.
This can be worked around easily of course:
{
my $foo;
my $bar;
foreach my $item (1..3) {
...
continue {
...
}
: Another mild frustration is:
:
: do_something($value) if my $value = more_processing();
: # doh, but $value's out of scope by then.
You can do this though:
if (my $value = more_processing()) {
do_something($value);
}
: Can anyone suggest gotchas for these two, i.e. if they worked how I'd like
: them to what would it break/lead to nasty things? What's the
: rationale/explanation for the second?
The first time $value is seen it hasn't been declared yet. That is,
the compiler will see "do_something($value)" before it sees the "my
$value". Lexical variables are in scope from there declaration to
the end of the current block, but not backwards before the
declaration. Making "foo($value) if my $value = bar()" work would
break this rule. Also, someone somewere might actually have some
code like this:
$foo = "foo";
print $foo if my $foo = "bar";
print $foo;
And expect to print "foo" and then "bar".
--
-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: Sun, 25 Oct 1998 01:09:45 +0200
From: Norbert Kolb <nkolb@htl.de>
Subject: Re: Net::Ping WON'T WORK!!!!!
Message-Id: <36325E38.E0DE3A90@htl.de>
hippie@net-alert.com wrote:
> It does not work when trying to ping Linux or
> > >Windows systems from a Linux machine. It does work, however, when pinging
> > >Solaris X86 and HP/UX machines.
I had same probs on the latest perl version. if you ever know the solution, feel
free to tell me.
Jester
------------------------------
Date: 24 Oct 1998 22:27:00 GMT
From: bobn@interaccess.com (Bob N.)
Subject: Re: Newbie help--perl won't run as CGI
Message-Id: <70tk7k$8vf$1@supernews.com>
Don't know if this is case on NT, but in Unix world, the httpd runs at a
low level of permissions, such that the CGI script and everything it needs
must be world executeable/readable.
HTH,
- Bob N.
In Article <3631D670.3F88C1A0@towergroup.com> , David Gibbons (dgibbons@towergroup.com) said:
: I am using Windows NT 4 server and IIS 4. I have installed perl, and
: made all ofthe associations, as per the documentation. My perl scripts
: run fine from the command line, but when I try them as a cgi script from
: a web page, the system just sits there. I have checked in Task Manager,
: and the perl interpreter is starting up, but not doing anything,
: apparently (at least it is not consuming any processor time).
:
: Can anyone help?
:
: Thanks,
:
: David L. Gibbons
:
------------------------------
Date: Sat, 24 Oct 1998 18:43:34 -0500
From: "Matt Johnson" <mjohnson@getonthe.net>
Subject: Re: Newbie help--perl won't run as CGI
Message-Id: <70tosd$pmc$1@news.ipa.net>
There is a great article on getting Perl and IIS to work together. Check
http://support.microsoft.com . Query on "Perl and IIS" and you should get
it.
My problem was when upgrading from IIS 3.0 to IIS 4.0, the application
mapping changed to all uppercase. This messed up the whole thing.
In IIS 4.0 your application mapping needs to have "PERL.EXE %s %s" and not
"%S"
I sure hope this helps someone. That way my past 6 hours wouldn't have been
as waisted.
Matt Johnson
cpuweb@cpuweb.com
David Gibbons wrote in message <3631D670.3F88C1A0@towergroup.com>...
>I am using Windows NT 4 server and IIS 4. I have installed perl, and
>made all ofthe associations, as per the documentation. My perl scripts
>run fine from the command line, but when I try them as a cgi script from
>a web page, the system just sits there. I have checked in Task Manager,
>and the perl interpreter is starting up, but not doing anything,
>apparently (at least it is not consuming any processor time).
>
>Can anyone help?
>
>Thanks,
>
>David L. Gibbons
>
------------------------------
Date: 24 Oct 1998 22:51:06 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Not to start a language war but..
Message-Id: <70tlkq$8gu$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, mso@eve.speakeasy.org (Mike Orr) writes:
:The more $@%{}/* -> => symbols, the better. Who cares
:if the result is an unreadable code?
This was a lie yesterday. It is a lie today. It shall be a lie tomorrow.
I realize I won't get you to cease and desist, but this wicked repetition
is empty propaganda based upon a gross misunderstanding that has been
exaggerated and repeated to no end. Repeat a lie often enough and
it is believed without examination. That doesn't make it right.
Our written expressions (you know: prose and such) are saddled with
ludicrous capital letters, apostrophes, commas, periods, colons, and
dashes -- not to mention parentheses. Who cares whether the result is
an illegible mess?
--tom
--
Mathematics: That branch of Human Thought which takes a finite set of trivial
axioms and maps them to a countably infinite set of unintuitive theorems.
------------------------------
Date: 24 Oct 1998 23:35:02 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Not to start a language war but..
Message-Id: <70to76$84t@mozo.cc.purdue.edu>
WMWilson <m.v.wilson@erols.com> writes:
}Just wondering why Perl is so much more popular than python...
One word: indentation.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Sat, 24 Oct 1998 14:34:53 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <MPG.109be7d566beddd39898de@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <70t79u$6q1$1@mathserv.mps.ohio-state.edu> on 24 Oct 1998
18:46:22 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.109b91f83063bb279898dc@nntp.hpl.hp.com>:
> > Perl is full of little
> > "gotchas" (samples on request), of which this is one of the smallest, or
> > at least one that has lots of history behind it.
>
> Request.
>
> Ilya
Oh, that is a fun assignment. I'm sure many will want to join in.
Here's just a couple to get started:
>From last week's discussion in ...moderated:
$x = /.../; # Boolean value of /.../
$x = /.../g; # Boolean value of /.../
$x = () = /.../g; # Number of matches of /.../
I think The Perl Cookbook will be a rich source. From page 2, for
example:
"" "0" 0 00 0.0 # FALSE
"00" "0.0" # TRUE
More when I have time. Back to Cal football now...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 24 Oct 1998 14:52:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <MPG.109bec0a84f7aa419898df@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <70t79u$6q1$1@mathserv.mps.ohio-state.edu> on 24 Oct 1998
18:46:22 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.109b91f83063bb279898dc@nntp.hpl.hp.com>:
> > Perl is full of little
> > "gotchas" (samples on request), of which this is one of the smallest, or
> > at least one that has lots of history behind it.
>
> Request.
Lest I or anyone forget, I'm sure 'perltrap' will be another rich
source, though it's primarily oriented at traps for those coming to Perl
from other languages.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 24 Oct 1998 23:04:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <70tmer$af$1@client3.news.psi.net>
J.P. Wright (jpw22@cus.cam.ac.uk) wrote on MDCCCLXXX September MCMXCIII
in <URL:news:Pine.SOL.3.96.981024114151.16407A-100000@taurus.cus.cam.ac.uk>:
++
++ Isn't the cost 4 bytes times the number of times you store or use a date?
++ Perhaps they expected to store lots and lots of dates, meaning the cost
++ becomes significant? Perhaps they never envisaged people using their code
++ in 20 years time? After all who used 20 year old code in 1978? (OK,
++ someone did and I don't want to hear about it)
How many times do you plan to store a NULL pointer? The extra array
element is only used in the conversion routine - you only need the
result just before printing.
Storing the year - 1900 in the tm struct is not saving anything.
Unless you only assign a single byte to the year field, and have
programs that are unable to work with dates too far away from
1970.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
------------------------------
Date: Sat, 24 Oct 1998 18:39:44 -0500
From: "Matt Johnson" <mjohnson@getonthe.net>
Subject: Re: Perl scripts under NT, something not right here.
Message-Id: <70tol7$plg$1@news.ipa.net>
There is a great article on getting Perl and IIS to work together. Check
http://support.microsoft.com . Query on "Perl and IIS" and you should get
it.
------------------------------
Date: Sat, 24 Oct 1998 18:39:26 -0500
From: "Matt Johnson" <mjohnson@getonthe.net>
Subject: Re: Perl under IIS 4.0?
Message-Id: <70tokl$pld$1@news.ipa.net>
There is a great article on getting Perl and IIS to work together. Check
http://support.microsoft.com . Query on "Perl and IIS" and you should get
it.
------------------------------
Date: Sat, 24 Oct 1998 17:28:36 -0400
From: Sarah Crawford <bast2657@sssnet.com>
Subject: PLEASE HELP SOON!!!
Message-Id: <36324684.38C7@sssnet.com>
Hello. I have been recently installing CGI scripts to my web site.
Each three of them are not working. The URLS are:
http://server7.hypermart.net/sarahpc/wwwboard/wwboard.html
http://server7.hypermart.net/sarahpc/orderform12.html
http://server7.hypermart.net/sarahpc/userpages/index.html
Help would be greatly appreciated, and I would be glad to give you free
services from my site for your help! Please relpy soon, I really need
to have these problems fixed by Tuesday!! Thanks
Sarah
------------------------------
Date: Sun, 25 Oct 1998 00:47:46 +0200
From: "Bertil Wennergren" <bertilow@algonet.se>
Subject: Re: Problems with plus sign in perl script
Message-Id: <70tlfn$f75$1@cubacola.tninet.se>
Tad McClellan wrote:
>Bertil Wennergren (bertilow@algonet.se) wrote:
>: use strict;
> You are to be commended for doing the Right Thing with
> that pragma there ;-)
Learned it the hard way... :-)
> $string1 =~ s|\Q$plus_sign|$plus_word|g; # see quotemeta() function
Thanks to all who pointed me to this mysterious \Q! That works,
but it all seems really unintuitive and weird to me. It seems I
ought to use this \Q quite a lot - actually everytime a variable
used in a regexp _might_ turn out to have a plus (or some other
bothersome character) in it. And variables have a tendency to vary,
so who knows what they might bring.
E.g.
#!/usr/bin/perl -w
use diagnostics;
use strict;
my $argument = "$ARGV[0]";
my $word = "and";
my $string = "Jack $argument Jill";
print "STRING: $string\n";
$string =~ s|$argument|$word|g;
print "STRING: $string\n";
This works smothly if the input is:
perl script.pl or
This prints:
STRING: Jack or Jill
STRING: Jack and Jill
But if some sneaky fellow were to input:
perl script.pl +
We'd get:
STRING: Jack + Jill
Uncaught exception from user code:
/+/: ?+*{} follows nothing in regexp at test3.pl line 13.
So I'd have to add the \Q (just in case):
#!/usr/bin/perl -w
use diagnostics;
use strict;
my $argument = "$ARGV[0]";
my $word = "and";
my $string = "Jack $argument Jill";
print "STRING: $string\n";
$string =~ s|\Q$argument|$word|g;
print "STRING: $string\n";
Which gives:
perl script.pl or
STRING: Jack or Jill
STRING: Jack and Jill
perl script.pl +
STRING: Jack + Jill
STRING: Jack and Jill
Am I on the right track to enlightment?
___________________________________________________________________
Bertilo Wennergren
<http://purl.oclc.org/NET/bertilo>
<bertilow@hem1.passagen.se>
___________________________________________________________________
------------------------------
Date: Sat, 24 Oct 1998 17:30:14 -0600
From: Lynn Wilson <lynn@swcp.com>
Subject: Using MS-Access with OLE
Message-Id: <36326306.5A417850@swcp.com>
All of the examples that I find that show how to create an
MS-Access database using Win32::OLE seem to not work for me. Are
these all using the ActivePerl version where I've chosen to use the
std version from CPAN?
All I want to do is to create a new database with a simple table
where I write a few fields. I've been using the OLE with MS-Excel
but I've exceeded the maximum allowable rows imposed by excel so
I'm hoping to simply move the interface over to Access.
Does anyone have sample code to create an Access database/table and
write a few items into it? Could you please post it?
Thanks.
Lynn
------------------------------
Date: Sat, 24 Oct 1998 22:59:37 GMT
From: jlewchuk@junctionnet.com (Michael Lewchuk)
Subject: Re: What isn't Perl good for?
Message-Id: <36325997.7071805@news.junctionnet.com>
On Tue, 20 Oct 1998 03:11:02 GMT, Elaine -HappyFunBall- Ashton
<eashton@bbnplanet.com> wrote:
>Martien Verbruggen wrote:
>
>> Perl isn't horrible at anything. And it is always time to use C.
Really? Perhaps you'd like to hire someone to write a 3DFX card device driver
in PERL for you, then be forced to maintain it.
>Perl never cooked for me. Anything else, it rocks. C is painful by
>comparison, from an SA POV anyway. The day Perl makes coffee and muffins
>for me in the morning, I'll never have eyes for another language. :)
>From my POV, it depends on what you're doing. If you're playing with UNIX
commands all day, PERL takes a real load off the old keyboard (and the fingers
thereby). If you're busy doing something that can't be explained as a simple
set of UNIX commands, then it's time to go for the old C/C++ manual. Those of
you who have been around computers for 20 years may understand this reference:
if it's a batch job, use PERL, if it's a program, use C/C++. In other words,
if you were limited to using shell commands only, could you do it? If so, use
PERL.
Also, from my POV, PERL is treated as a programming language, which it's not.
If you try to treat it like one, you will fail miserably in producing good
code. Either it'll be illegible, unmaintainable, buggy, incomprehensible, or
all of the above. You'll try to turn a program into a batch job, thereby
producing a botch job instead.
The only reason to move from C/C++ to PERL is that you can do many high-level
useful things easily. PERL is not better than C/C++, it's just easier on the
brain and fingers for high-level tasks.
Michael J. Lewchuk
jlewchuk@junctionnet.com
------------------------------
Date: 24 Oct 1998 22:22:09 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: why use do BLOCK?
Message-Id: <909267765.472836@thrush.omix.com>
Boson <boson@earthlink.net> wrote:
: Hello,
: I have been looking for examples that shows the benefit of using the
: do BLOCK format. I could only find examples like this one:
:
: $file = do {local $/; scalar <FILE>};
: versus
: $/ = undef;
: $file = <FILE>;
:
: But that merely looks like a question of style to me.
It's not though. Changing the value of $/ is a *very* dangerous
thing to do as most code is expecting to be set to the default "\n".
By using a block and localizing it, you help insure that code called
outside of that block will get the value of $/ that it expected.
The "do" isn't needed, but the block should be used. Without the
"do" it looks like this:
my $file;
{
local $/;
$file = <FILE>;
}
: It would be
: great if someone had a real nifty example of how to use do{...} that
: would convince me to use do more often.
I almost never use do{} without an extra while() or until().
But I use blocks all the time:
{
my $count = 0;
sub up { ++$count };
sub down { --$count };
sub current { $count };
}
{
package FooBar;
$foo = "foo";
}
print $FooBar::foo;
{
no strict 'refs';
&$foo (); ## an evil soft ref sub call
}
--
-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: 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 4063
**************************************