[17968] in Perl-Users-Digest
Perl-Users Digest, Issue: 128 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 23 18:05:42 2001
Date: Tue, 23 Jan 2001 15:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980291113-v10-i128@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 23 Jan 2001 Volume: 10 Number: 128
Today's topics:
ActiveState and Tk zatlas@juno.com
Adobe Acrobat/FrameMaker <hanja@my-deja.com>
Benchmark For ActiveState Win32 <godzilla@stomp.stomp.tokyo>
Re: Benchmark For ActiveState Win32 <chrisw@dynamite.com.au>
Re: Benchmark For ActiveState Win32 <godzilla@stomp.stomp.tokyo>
Re: Directory Recursion Problem. (Craig Berry)
Re: Formatting a number to a currency string iwelch@my-deja.com
how to set maxmessage in RPC::PlServer::Comm <loy_x@yahoo.com>
Re: how to set maxmessage in RPC::PlServer::Comm <loy_x@yahoo.com>
howto s/// using variables? <ciechowski@cis-computer.com>
Re: howto s/// using variables? (Abigail)
Re: Is there a fflush? <jwl@sgi.com>
Re: Newbie Perl Problem (Mark Jason Dominus)
Re: Newbie question : Read configuration file. (Craig Berry)
Re: Newbie question : Read configuration file. (Damian James)
partition a large file into a number of small ones <ydzhang@iastate.edu>
Re: partition a large file into a number of small ones (Derek M. Flynn)
Re: partition a large file into a number of small ones <monty@primenet.com>
Re: partition a large file into a number of small ones <katz@alf.dec.com>
Re: partition a large file into a number of small ones <neldredge@hmc.edu>
Re: partition a large file into a number of small ones <peter.sundstrom@eds.com>
Re: Passing parameters to a script <lshatzer@islanddata.com>
Re: Passing parameters to a script (Arek P)
Performing ops on matched strings <xxxtmanningxxx@canada.com>
Re: Performing ops on matched strings (Damian James)
perlxstut stevezaz@my-deja.com
Re: POE oppinion <bas@integrators.demon.nl>
Port old GL/C/SGI app to NT app using Perl <Brett.W.Denner@lmco.com>
Re: Posting email from PERL to Outlook (Exchange)??? <a565a87@my-deja.com>
printing to a printer? <hanja@my-deja.com>
Re: Q: socket communication between perl and java time4tea@my-deja.com
Re: Random Numbers with a Twist <iltzu@sci.invalid>
regex substitution w/variable replacement rickroot@my-deja.com
Re: regex substitution w/variable replacement nexus6_kills@yahoo.com
Re: s/// inconsistency <wuerz@yahoo.com>
Re: Why (Craig Berry)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 Jan 2001 20:15:05 GMT
From: zatlas@juno.com
Subject: ActiveState and Tk
Message-Id: <94konv$emo$1@nnrp1.deja.com>
Hi everybody
The documentation of ActiveState ActivePerl (for Win32) states
(http://theoryx5.uwinnipeg.ca/CPAN/data/Tk/README-ActiveState.txt.html) that:
" When you install ActivePerl, it provides patched C runtime as PerlCRT.dll
which it installs in the "system32" directory.
This needs "administrator" rights on NT.
It also provides the import library PerlCRT.lib, but this is installed
in an odd location e.g. C:\ActivePerl\lib\CORE\PerlCRT.lib
where it is not found by MakeMaker or VC++.
I copied it to C:\VisualStudio\VC98\lib\PerlCRT.lib
(Your paths may vary dependinh where you installed ActivePerl and VC++.)"
I installed the latest ActivePerl, ActivePython and and ActiveState Komodo
IDE (Beta 1.0) and I can't find neither PerlCRT.lib nor PerlCRT.lib. When I
compile the statement use Tk; I get: "Can't locate Tk.pm in @INC (@INC
contains: C:\Program
Files\Komodo\Mozilla\chrome\komodo\content\perl/MSWin32-x86-multi-thread
C:\Program Files\Komodo\Mozilla\chrome\komodo\content\perl E:/Perl/lib
E:/Perl/site/lib .) at E:\test1 \tkdialog.pl line 1.". I have VC6.0
installed. Apparently I missed something in the installation process. Any
suggestion will be appericiated. Thanks ZA
--
ZAConsaltants, the Performance Experts
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 23 Jan 2001 20:48:05 GMT
From: hanja <hanja@my-deja.com>
Subject: Adobe Acrobat/FrameMaker
Message-Id: <94kqm0$glh$1@nnrp1.deja.com>
Know where I can view some scripts that involve
these two programs?
Just asking,
-hanja
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 23 Jan 2001 13:36:01 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Benchmark For ActiveState Win32
Message-Id: <3A6DF941.3FF019F1@stomp.stomp.tokyo>
Any work-around available for installing a
benchmark module under ActiveState 5.6
for Win32?
Your advice is appreciated.
Godzilla!
------------------------------
Date: Wed, 24 Jan 2001 08:47:26 +1100
From: "Chris W" <chrisw@dynamite.com.au>
Subject: Re: Benchmark For ActiveState Win32
Message-Id: <9%mb6.15$Q82.1753@news0.optus.net.au>
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3A6DF941.3FF019F1@stomp.stomp.tokyo...
>
> Any work-around available for installing a
> benchmark module under ActiveState 5.6
> for Win32?
You mean other than the Benchmark module that's a standard part of the
distribution (Build 623) ?
------------------------------
Date: Tue, 23 Jan 2001 14:41:05 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Benchmark For ActiveState Win32
Message-Id: <3A6E0881.4F036029@stomp.stomp.tokyo>
Chris W wrote:
> Godzilla! wrote:
> > Any work-around available for installing a
> > benchmark module under ActiveState 5.6
> > for Win32?
> You mean other than the Benchmark module that's
> a standard part of the distribution (Build 623) ?
I am running build 618 for Win32. A benchmark module is
not included. I tried a DOS search of ActiveState for
a benchmark module, no luck.
However, I have come across some release notes on
using MicroSoft nmake.exe to prepare a CPAN module,
such as benchmark, for a binary install to Win32.
Just located these notes buried in documentation.
Not so sure it sounds like a good idea; lots of
hoops through which to leap. I'll give it a try
anyhow, with fingers crossed for luck.
Before I do this, I will visit ActiveState and
discover if a newer build for Win32 is available,
perhaps this build 623 you mention.
I am hoping someone with experience installing
a benchmark module for build 618 Win32 might
read this and provide some helpful suggestions
based on real life experience.
Thanks for this info, Chris. I will check
into this 623 build.
Godzilla!
------------------------------
Date: Tue, 23 Jan 2001 19:17:44 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Directory Recursion Problem.
Message-Id: <t6rm6of76dhob5@corp.supernews.com>
Martien Verbruggen (mgjv@tradingpost.com.au) wrote:
: I wonder if we could get MS OUtlook made illegal in sensible countries
: that already ban guns.
I'd suggest imposing a mandatory waiting period, but Windows boot already
covers that. :)
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "The hills are burning, and the wind is raging; and the clock
| strikes midnight in the Garden of Allah." - Don Henley
------------------------------
Date: Tue, 23 Jan 2001 21:25:40 GMT
From: iwelch@my-deja.com
Subject: Re: Formatting a number to a currency string
Message-Id: <94kss6$ivc$1@nnrp1.deja.com>
well, I read the faq on cpan, looking for commify, but I just cannot
find it there. the sprintf + commify solution seems rather inelegant.
this seems to be the sort of thing where one should write a function
from scratch in C, rather than use multiple manipulations...
Subject:
Re: Formatting a number to a currency string
Date:
07/10/1999
Author:
David Cassell <cassell@mail.cor.epa.gov>
<< previous in thread ·
next >>
Doc Data wrote:
>
> I saw that in the faq but it would appear that it only adds commas
and currency
> format also requires 2 zero-filled decimal places.
Yippee! Someone else who read the FAQ first!
That makes you only the second today, I think.
Yes, that part of the FAQ only tells about shoving commas into
a string of numbers. You'll want to look up the printf() and
sprintf() functions, which can do the 2-decimal-place padding
you're looking for. The newest version of the FAQ has this
in it as well, with *corrected* answers, thanks to Uri.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 23 Jan 2001 11:35:53 -0800
From: news <loy_x@yahoo.com>
Subject: how to set maxmessage in RPC::PlServer::Comm
Message-Id: <3A6DDD19.4140463F@yahoo.com>
Using dbiproxy and receiving error messages that suggest increasing
maxmessage in Comm.pm. I'm not quite sure how to do this though. The
RPC::PlServer docs briefly mention this attribute but do not show where
to set it. Adding it to the dbiproxy server config file doesn't help. I
don't want to change Comm.pm directly, if I don't have to(and I'm pretty
sure I shouldn't have to).
If anyone has encountered this problem and found a solution, please
reply. Thanks.
------------------------------
Date: Tue, 23 Jan 2001 11:40:15 -0800
From: news <loy_x@yahoo.com>
Subject: Re: how to set maxmessage in RPC::PlServer::Comm
Message-Id: <3A6DDE1F.2D182C7D@yahoo.com>
btw, here is my dbiproxy server config file
---------------------
{
'localport' => 4321,
'pidfile' => 'c:\temp\dbiproxy.pid',
'logfile' => 1,
'debug' => 1,
'maxmessage' => 200000,
'mode' => 'single',
'timeout' => 60,
'clients' => [
{
'mask' => '<myclientip>',
'accept' => 1,
'maxmessage' => 200000
}
]
}
news wrote:
> Using dbiproxy and receiving error messages that suggest increasing
> maxmessage in Comm.pm. I'm not quite sure how to do this though. The
> RPC::PlServer docs briefly mention this attribute but do not show where
> to set it. Adding it to the dbiproxy server config file doesn't help. I
> don't want to change Comm.pm directly, if I don't have to(and I'm pretty
> sure I shouldn't have to).
>
> If anyone has encountered this problem and found a solution, please
> reply. Thanks.
------------------------------
Date: Tue, 23 Jan 2001 22:38:17 +0100
From: Ingo Ciechowski <ciechowski@cis-computer.com>
Subject: howto s/// using variables?
Message-Id: <01HW.B693B859001C86171DA08580@News.CIS.DFN.DE>
It must be pretty easy, but I don't get it right now...
I want to search and replace using an array of search and replace strings on
my content:
@filter = ( [ "<!--COMMENTA[^>]*>", "" ],
[ "<META NAME=\"NAME\" CONTENT=([^>]*)>", "$1" ],
);
for ($i=0; $i < scalar @filter; $i++) {
$content =~ s/$filter[$i][0]/$filter[$i][1]/sg;
}
unfortunately $1 is getting evaluated when the array is initialized - if I
put \$1 into the array this of course remains fine, but then $filter[$i][1]
in the replacement part will not be replaced by $1 from the match, but by the
string "$1" :-((
so how do I make Perl use $filter[$i][1] as if it was typed as follows:
$content =~ s/<META NAME=\"NAME\" CONTENT=([^>]*)>/$1/sg;
Any help's really appreciated.
--
Ingo
ciechowski@cis-computer.com
------------------------------
Date: 23 Jan 2001 22:13:16 GMT
From: abigail@foad.org (Abigail)
Subject: Re: howto s/// using variables?
Message-Id: <slrn96s0fs.ksd.abigail@tsathoggua.rlyeh.net>
Ingo Ciechowski (ciechowski@cis-computer.com) wrote on MMDCCII September
MCMXCIII in <URL:news:01HW.B693B859001C86171DA08580@News.CIS.DFN.DE>:
|| It must be pretty easy, but I don't get it right now...
||
|| I want to search and replace using an array of search and replace strings on
|| my content:
||
||
|| @filter = ( [ "<!--COMMENTA[^>]*>", "" ],
|| [ "<META NAME=\"NAME\" CONTENT=([^>]*)>", "$1" ],
|| );
||
||
|| for ($i=0; $i < scalar @filter; $i++) {
|| $content =~ s/$filter[$i][0]/$filter[$i][1]/sg;
|| }
||
||
||
|| unfortunately $1 is getting evaluated when the array is initialized - if I
|| put \$1 into the array this of course remains fine, but then $filter[$i][1]
|| in the replacement part will not be replaced by $1 from the match, but by the
|| string "$1" :-((
||
|| so how do I make Perl use $filter[$i][1] as if it was typed as follows:
|| $content =~ s/<META NAME=\"NAME\" CONTENT=([^>]*)>/$1/sg;
One way is to use anon subs:
@filter = (sub {$_ [0] =~ s/<!--COMMENTA[^>]*>//sg},
sub {$_ [0] =~ s/<META NAME="NAME" CONTENT=([^>]*)>/$1/sg});
map {$_ -> ($content)} @filter;
Another way is to use '$1' in @filter and s///sgee, but that's not as
flexible, as you would need '"foo"' to replace something with a fixed
string.
Abigail
--
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/ xor !@ _?
exit print :
print and push @_ => shift and goto &{(caller (0)) [3]}}
split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
------------------------------
Date: Tue, 23 Jan 2001 16:23:14 -0500
From: Jim Lynch <jwl@sgi.com>
Subject: Re: Is there a fflush?
Message-Id: <3A6DF642.7837916C@sgi.com>
I knew I'd get flames from this group, but I also knew I stood a good
chance of getting an answer. Yes, I'm a perl programmer but no I don't
know all the answers and I'm still learning. I read the "If set to
nonzero, forces a flush right away and after every write or print on the
currently
selected output channel"
But the phrase "currently selected output channel" didn't register.
Thank you all for the information.
Jim.
Jim Lynch wrote:
>
> I'm using Perl on a Unix system and know about $|, but I'm trying to
> write a log file to other than standard out and would dearly love to
> have an fflush function. I don't see it in the documents that I have
> anywhere. I'd sure like to be able to tail -f the log file to get an
> idea where the program is at any given time. Does anyone have any
> suggestions?
>
> Thanks,
> Jim.
------------------------------
Date: Tue, 23 Jan 2001 19:20:28 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Newbie Perl Problem
Message-Id: <3a6dd97b.501e$f8@news.op.net>
In article <94h4s9$96l$1@nnrp1.deja.com>, <badass101@my-deja.com> wrote:
>I have a variable, $text1, which is full of text.
>I want to strip the whitespace and new lines out of the file so that i
>get a list of words, seperated by a space,
>
>e.g.
>word1 word2 word3
>
>How can i do this easily??
$text1 =~ tr{ \t\n\r}{ }s;
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Tue, 23 Jan 2001 19:32:54 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Newbie question : Read configuration file.
Message-Id: <t6rn362iptmdb0@corp.supernews.com>
Andy Geraerts (angeraer@hotmail.com) wrote:
: I have a few simple perl scripts. They all use variables. Some of these
: variables are used over all my scripts and have the same value. What is the
: easiest way to read out an configuration file which I would put under /etc?
: Is it possible to do some kind of include?
It is (see 'require' and 'use') if your config file is itself valid perl,
which yours is not. But it's also pretty easy to read and parse the sort
of file you show below. Do note that it's vastly superior to read
configuration parameters and their values into a hash (like %cfg) and
reference them through that, rather than blindly creating variables in the
package. But this is harder to do post facto, if your code already has
lots of raw-scalar config variable references.
: Example config file :
:
: #/etc/config.file
: #Comment
: Servername=Server.Belgium
:
: I would like to read and set the variable Servername to Server.Belgium.
Assuming config file is open as CFG:
while (<CFG>) {
next if /^#/; # Discard comments
next unless /^(\w+)=(.*)/; # Ignore bad syntax, empty lines
$$1 = $2;
}
Note this won't work under 'strict refs'.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "The hills are burning, and the wind is raging; and the clock
| strikes midnight in the Garden of Allah." - Don Henley
------------------------------
Date: 23 Jan 2001 22:29:07 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Newbie question : Read configuration file.
Message-Id: <slrn96s1el.n2o.damian@puma.qimr.edu.au>
Thus spake Craig Berry on Tue, 23 Jan 2001 19:32:54 -0000:
>Andy Geraerts (angeraer@hotmail.com) wrote:
>: I have a few simple perl scripts. They all use variables. Some of these
>: variables are used over all my scripts and have the same value. What is the
>: easiest way to read out an configuration file which I would put under /etc?
>: Is it possible to do some kind of include?
>
>It is (see 'require' and 'use') if your config file is itself valid perl,
>which yours is not. But it's also pretty easy to read and parse the sort
>of file you show below. Do note that it's vastly superior to read
>configuration parameters and their values into a hash (like %cfg) and
^^^^
Indeed -- I'm not sure why you suggest symrefs instead below.
>reference them through that, rather than blindly creating variables in the
>package. But this is harder to do post facto, if your code already has
>lots of raw-scalar config variable references.
Surely it's better to fix these rather than await future scoping problems
and namespace conflicts?
>
>: Example config file :
>:
>: #/etc/config.file
>: #Comment
>: Servername=Server.Belgium
>:
>: I would like to read and set the variable Servername to Server.Belgium.
>
>Assuming config file is open as CFG:
>
> while (<CFG>) {
> next if /^#/; # Discard comments
> next unless /^(\w+)=(.*)/; # Ignore bad syntax, empty lines
> $$1 = $2;
> }
>
>Note this won't work under 'strict refs'.
Changing that assignment line to:
$config{$1} = $2;
would be better (and would work under 'strict refs' - having pre-declared
%config, of course).
Cheers,
Damian
------------------------------
Date: Tue, 23 Jan 2001 15:19:13 -0600
From: "Y. Zhang" <ydzhang@iastate.edu>
Subject: partition a large file into a number of small ones
Message-Id: <3A6DF551.C04F847@iastate.edu>
Hi,
I have a text file which is huge one (~270mb) with million lines. I
want to divide this file into small ones (50 mb or 4000 lines each). I
am use a unix osf system.
Any advice is appreciated.
Yuandan
------------------------------
Date: Tue, 23 Jan 2001 21:40:45 GMT
From: dmf@cs.uchicago.edu (Derek M. Flynn)
Subject: Re: partition a large file into a number of small ones
Message-Id: <slrn96ruj2.jke.dmf@gargoyle.cs.uchicago.edu>
Y. Zhang wrote:
> Hi,
> I have a text file which is huge one (~270mb) with million lines. I
> want to divide this file into small ones (50 mb or 4000 lines each). I
> am use a unix osf system.
>
> Any advice is appreciated.
man split
------------------------------
Date: 23 Jan 2001 22:07:46 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: partition a large file into a number of small ones
Message-Id: <94kvbi$1i3$1@nnrp2.phx.gblx.net>
Derek M. Flynn wrote:
> Y. Zhang wrote:
> > I have a text file which is huge one (~270mb) with million lines. I
> > want to divide this file into small ones (50 mb or 4000 lines each).
> > I am use a unix osf system.
>
> man split
Also, man csplit.
The csplit command splits files according to criteria, including
regular expression patterns.
--
Jim Monty
monty@primenet.com
Tempe, Arizona USA
------------------------------
Date: Tue, 23 Jan 2001 17:08:00 -0500
From: Robert Katz <katz@alf.dec.com>
Subject: Re: partition a large file into a number of small ones
Message-Id: <3A6E00C0.64FCB082@alf.dec.com>
"Y. Zhang" wrote:
>
> Hi,
> I have a text file which is huge one (~270mb) with million lines. I
> want to divide this file into small ones (50 mb or 4000 lines each). I
> am use a unix osf system.
>
> Any advice is appreciated.
Look at the man page for `split', and it will give you
everything you need.
---Robert
>
> Yuandan
------------------------------
Date: 23 Jan 2001 14:50:49 -0800
From: Nate Eldredge <neldredge@hmc.edu>
Subject: Re: partition a large file into a number of small ones
Message-Id: <83itn5anna.fsf@mercury.st.hmc.edu>
"Y. Zhang" <ydzhang@iastate.edu> writes:
> Hi,
> I have a text file which is huge one (~270mb) with million lines. I
> want to divide this file into small ones (50 mb or 4000 lines each). I
> am use a unix osf system.
man split. If you don't have it, get the GNU version from the
textutils package at ftp.gnu.org.
--
Nate Eldredge
neldredge@hmc.edu
------------------------------
Date: Wed, 24 Jan 2001 11:40:40 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: partition a large file into a number of small ones
Message-Id: <94l1pd$nbr$1@hermes.nz.eds.com>
"Y. Zhang" <ydzhang@iastate.edu> wrote in message
news:3A6DF551.C04F847@iastate.edu...
> Hi,
> I have a text file which is huge one (~270mb) with million lines. I
> want to divide this file into small ones (50 mb or 4000 lines each). I
> am use a unix osf system.
man split
------------------------------
Date: Tue, 23 Jan 2001 11:27:04 -0800
From: "Larry Shatzer" <lshatzer@islanddata.com>
Subject: Re: Passing parameters to a script
Message-Id: <94klvt$26vr$1@thoth.cts.com>
I would suggest Getopt::Std.
http://www.perldoc.com/perl5.6/lib/Getopt/Std.html
Miguel Manso <mmanso@localhost.localdomain> wrote in message
news:slrn96rjaj.1l1.mmanso@localhost.localdomain...
> Hi ppl.
>
> I'm trying to write a perl script that accepts three optional parameters.
> Lets say:
> PARAM1, PARAM2 and PARAM3
>
> When I execute the program like:
>
> program.pl PARAM1 PARAM2 PARAM3
>
> i know that the the parameters will be available in the @ARGV array.
>
> Now, has told, the parameters are optional, so, if I call the script like:
>
> program.pl PARAM1 PARAM3
>
> the @ARGV will have two elements and I can't tell which one is which... I
> mean, $ARGV[1] in this case is PARAM3 and not PARAM2.
>
> Is there any technique to avoid this problem?
>
> Thanks.
------------------------------
Date: Tue, 23 Jan 2001 15:28:39 EST
From: Arek@nospam.tv (Arek P)
Subject: Re: Passing parameters to a script
Message-Id: <94kphn$khh$1@earth.superlink.net>
On Tue, 23 Jan 2001 18:24:06 GMT, mmanso@localhost.localdomain (Miguel
Manso) wrote:
One that I can think of is GetOpt,
perldoc Getopt::Std
where U could specify that input params should be passed like this
Yourscript.pl -p1PARAM1 -p3PARAM3
Otherwise, I could not see the way for it to distinguish between 2 and
3 if 2 is omitted. If 2 and 3 are different type of data, You can
check for that if possible....
HTH
ArekP
>Hi ppl.
>
>I'm trying to write a perl script that accepts three optional parameters.
>Lets say:
>PARAM1, PARAM2 and PARAM3
>
>When I execute the program like:
>
>program.pl PARAM1 PARAM2 PARAM3
>
>i know that the the parameters will be available in the @ARGV array.
>
>Now, has told, the parameters are optional, so, if I call the script like:
>
>program.pl PARAM1 PARAM3
>
>the @ARGV will have two elements and I can't tell which one is which... I
>mean, $ARGV[1] in this case is PARAM3 and not PARAM2.
>
>Is there any technique to avoid this problem?
>
>Thanks.
------------------------------
Date: Tue, 23 Jan 2001 22:46:28 GMT
From: Tom <xxxtmanningxxx@canada.com>
Subject: Performing ops on matched strings
Message-Id: <8Rnb6.50504$OD6.4615123@news1.telusplanet.net>
Hey all, should be a SIMPLE question for you :). BTW, if this can be found
on some document somewhere please feel free to point me to it :)
Problem:
I have an HTML file with a zillion things in it, among them some prices,
separated by commas. I want to increase the prices by a certain formula. I
was thinking of writing something like this:
$i =~ s/\$(.*?),/<insert replace function here>/g;
Solution? :
How do I use a formula to manipulate the matched floating point number, and
stick it back in the text??
I want to change the matched number (eg 2.41) to ((2.41 / 1.1) + 2.41)
Can this be done?
Thanks,
Tom
------------------------------
Date: 23 Jan 2001 23:01:51 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Performing ops on matched strings
Message-Id: <slrn96s3c1.n2o.damian@puma.qimr.edu.au>
Thus spake Tom on Tue, 23 Jan 2001 22:46:28 GMT:
>...
>Problem:
>I have an HTML file with a zillion things in it, among them some prices,
>separated by commas. I want to increase the prices by a certain formula. I
>was thinking of writing something like this:
>
>$i =~ s/\$(.*?),/<insert replace function here>/g;
>
>Solution? :
>How do I use a formula to manipulate the matched floating point number, and
>stick it back in the text??
>
>I want to change the matched number (eg 2.41) to ((2.41 / 1.1) + 2.41)
>
On the perlop manpage, look under s/// and see the example given for
using the /e option.
HTH
Cheers,
Damian
------------------------------
Date: Tue, 23 Jan 2001 22:27:57 GMT
From: stevezaz@my-deja.com
Subject: perlxstut
Message-Id: <94l0h0$mgd$1@nnrp1.deja.com>
Hi,
Trying to do example 4 in perlxstut and When I run make test I get
this error
$ make test
make: Fatal error: Don't know how to make target `pure_all'
Does anyone know how to fix this.
Thanks
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 23 Jan 2001 21:03:03 +0100
From: "Bas A. Schulte" <bas@integrators.demon.nl>
Subject: Re: POE oppinion
Message-Id: <bas-ED78C8.21030323012001@news.demon.nl>
Hi,
> I've beed reading some documents about a moddule named POE and it seems
> very good for applications like daemons and stuff.
Just recently, a fine article on how to use POE appeared on
www.perl.com, might wanna check it out there.
Regards,
Bas.
------------------------------
Date: Tue, 23 Jan 2001 15:12:04 -0600
From: Brett Denner <Brett.W.Denner@lmco.com>
Subject: Port old GL/C/SGI app to NT app using Perl
Message-Id: <3A6DF3A4.8C982E6C@lmco.com>
I have been asked if I can take an old application written in C using GL on
an SGI, and make it work on a Windows NT platform. My thought is to use
Perl and Tk (since Tk is the graphics system I'm most familiar with) to
create the framework, and then to call the existing subroutines in the old
application which do the GL stuff (after porting them to OpenGL).
Is this possible, and, if so, what libraries and/or Perl modules would I
need to use?
Thanks,
Brett Denner
------------------------------
Date: Tue, 23 Jan 2001 19:20:59 GMT
From: Rob <a565a87@my-deja.com>
Subject: Re: Posting email from PERL to Outlook (Exchange)???
Message-Id: <94klie$bms$1@nnrp1.deja.com>
Dan,
Wow! Great!
I would have never guessed to say " qw(in with)" after "use Win32::OLE"
particularly given the arcana that the intrepreter responded with in
that circumstance. I'll go to the book store later and read up on what
exactly that means (I've got Perl stuff to learn.)
For your Outlook stuff, point yer URL to www.cdolive.com (CDO is a
messaging dialect of VB). Much higher level than MAPI, but it exposes
the ActiveX Automation features. Also familiarize yourself with the
CreateObject() and GetObject().
Thanks,
-Rob
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 23 Jan 2001 20:34:11 GMT
From: hanja <hanja@my-deja.com>
Subject: printing to a printer?
Message-Id: <94kps3$fs9$1@nnrp1.deja.com>
Is it possible to print a file to a printer instead
to the screen?
Just curious,
hanja
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 23 Jan 2001 22:32:39 GMT
From: time4tea@my-deja.com
Subject: Re: Q: socket communication between perl and java
Message-Id: <94l0q7$mt3$1@nnrp1.deja.com>
In article <94kh0a$70h$1@nnrp1.deja.com>,
time4tea@my-deja.com wrote:
>
> This program is different from fwdport, cos it uses Event, so that all
> processing is done as a single program (no forks)
Oops. Actually it doesn't use Event at all does it... but it could.
Cheers
James
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 23 Jan 2001 22:02:28 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Random Numbers with a Twist
Message-Id: <980286915.24144@itz.pp.sci.fi>
In article <slrn96pl9i.meu.mgjv@martien.heliotrope.home>, Martien Verbruggen wrote:
>One thing you could do is calculate two packings of the grid, to find an
>upper limit to what is possible at all. Pack it squarely, and
>hexagonally (you do need to do both for some pathological cases where a
>square packing will turn out to allow more than a hexagonal packing).
IIRC, there are actually cases where more circles can fit into a
finite square using an irregular packing than with any regular one.
Even this is a surprisingly hard problem.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"no one could take it seriously, though lots of people have."
-- Ian A. York in rec.arts.sf.composition
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Tue, 23 Jan 2001 20:52:36 GMT
From: rickroot@my-deja.com
Subject: regex substitution w/variable replacement
Message-Id: <94kque$h27$1@nnrp1.deja.com>
I am writing a find/replace script to use against our database, and I've
written it to take all of it's input from a file - the intention being
that it's a completely generic find and replace tool.
My problem is that I cannot seem to have a replacement string that uses
\1 in it.
For example, consider the following program:
#!/usr/local/bin/perl
$foo = "<A HREF=\"/stations/kdrkfmtop10\">Hot Movies</A>";
$find = "/stations/(.{5,6})top10";
$foo =~ s/$find/\/stations\/$1top5/g;
print "$foo\n";
This works wonderfully.
HOWEVER, I need the replace criteria to come from a variable.. as in the
following example:
#!/usr/local/bin/perl
$foo = "<A HREF=\"/stations/kdrkfmtop10\">Hot Movies</A>";
$find = "/stations/(.{5,6})top10";
### put replace into a variable, escape the $1
$replace = "/stations/\$1top5";
$foo =~ s/$find/$replace/g;
print "$foo\n";
This does not work. I've tried a wide variety of variations when
setting the $replace variable, such as:
$replace = '/stations/$1top5';
$replace = "/stations/\\1top5";
etc..
And so far, nothing has worked.
Please help. Good vibes will be sent your way if you have a solution
for me.
- Rick Root
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 23 Jan 2001 22:37:49 GMT
From: nexus6_kills@yahoo.com
Subject: Re: regex substitution w/variable replacement
Message-Id: <94l13t$n2c$1@nnrp1.deja.com>
Try something like:
=================================================
#!/usr/local/bin/perl
use strict;
my ($foo) = "<A HREF=\"/stations/kdrkfmtop10\">Hot
Movies</A>";
my ($find) = "/stations/(.{5,6})top10";
my ($replace) = "/stations/_xx_top5";
if ($foo =~ $find) {
my $tmp = $1;
$replace =~ s/_xx_/$tmp/;
}
$foo =~ s/$find/$replace/g;
print "$foo\n";
=================================================
In article <94kque$h27$1@nnrp1.deja.com>,
rickroot@my-deja.com wrote:
> I am writing a find/replace script to use against our database, and
I've
> written it to take all of it's input from a file - the intention being
> that it's a completely generic find and replace tool.
>
> My problem is that I cannot seem to have a replacement string that
uses
> \1 in it.
>
> For example, consider the following program:
>
> #!/usr/local/bin/perl
> $foo = "<A HREF=\"/stations/kdrkfmtop10\">Hot Movies</A>";
> $find = "/stations/(.{5,6})top10";
> $foo =~ s/$find/\/stations\/$1top5/g;
> print "$foo\n";
>
> This works wonderfully.
>
> HOWEVER, I need the replace criteria to come from a variable.. as in
the
> following example:
>
> #!/usr/local/bin/perl
> $foo = "<A HREF=\"/stations/kdrkfmtop10\">Hot Movies</A>";
> $find = "/stations/(.{5,6})top10";
> ### put replace into a variable, escape the $1
> $replace = "/stations/\$1top5";
> $foo =~ s/$find/$replace/g;
> print "$foo\n";
>
> This does not work. I've tried a wide variety of variations when
> setting the $replace variable, such as:
>
> $replace = '/stations/$1top5';
> $replace = "/stations/\\1top5";
> etc..
>
> And so far, nothing has worked.
>
> Please help. Good vibes will be sent your way if you have a solution
> for me.
>
> - Rick Root
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 23 Jan 2001 20:35:25 +0100
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: s/// inconsistency
Message-Id: <230120012035258447%wuerz@yahoo.com>
In article <slrn96qmb0.2q0.bernard.el-hagin@gdndev25.lido-tech>,
bernard.el-hagin@lido-tech.net wrote:
> >> >#!/usr/bin/perl -w
> >> >use strict ;
> >> >
> >> >$_='foobar';
> >> >$sub = '$2$1 ';
> >> >s/(foo)(bar)/$sub/;
> >> >print ;
> If you really cut-and-pasted the above code you'd get:
[error messages]
Ah, I understand now. Of course I had cut-and-pasted the whole of
Roman's code, and was therefore carrying $1 and $2 over from the
previous match. Thanks. (Also, thanks to Martien for pointing this
out.)
-mona
------------------------------
Date: Tue, 23 Jan 2001 19:20:27 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Why
Message-Id: <t6rmbrcvoe6b0b@corp.supernews.com>
James Taylor (james@NOSPAM.demon.co.uk) wrote:
: > > $newch=~s/+/ /g;
: >
: > Looks fine to me,
:
: Where's my head today!
: Yes, backslash escape the + as others have suggested.
Or, both more concisely and more efficiently:
$newch =~ tr/+/ /;
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "The hills are burning, and the wind is raging; and the clock
| strikes midnight in the Garden of Allah." - Don Henley
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V10 Issue 128
**************************************