[13534] in Perl-Users-Digest
Perl-Users Digest, Issue: 944 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 29 14:07:28 1999
Date: Wed, 29 Sep 1999 11:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938628313-v9-i944@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 29 Sep 1999 Volume: 9 Number: 944
Today's topics:
Re: #exec cgi <test@hhhd.com>
Re: $_ assignment (M.J.T. Guy)
Re: acos function (Abigail)
Re: Advice wanted: Creating an .exe <bivey@teamdev.com>
Re: Advice wanted: Creating an .exe (Henry Penninkilampi)
another newbie :) <emulov@NOSPAMsin.khk.be>
Re: another newbie :) (Mark A. Hershberger)
Re: Can in UNIX, But How in Perl (Steven Alexander)
Re: Can in UNIX, But How in Perl <rhomberg@ife.ee.ethz.ch>
Re: counting problem (Abigail)
Re: deprecated $[ (Abigail)
Re: Expert question: wrapping a subroutine (Abigail)
Re: Form to Mail Script on NT. How? (Henry Penninkilampi)
Re: Good Perl book <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Re: How to convert perl file into binaries? <Chicheng_Zhang-P29601@email.mot.com>
Re: hyperlink submits <flavell@mail.cern.ch>
Re: Insert blank line between two lines? <rhomberg@ife.ee.ethz.ch>
Re: Insert blank line between two lines? (Abigail)
Re: Installing ActiveState 51X and PPM <mck@iag.net>
Re: kill extra white space in a variable (Abigail)
Re: kill extra white space in a variable <crt@kiski.net>
Re: Match and escape processing (M.J.T. Guy)
Re: newbie help: sorting multidimensional arrays <rhomberg@ife.ee.ethz.ch>
Re: Perl Telnet to a system not needing login id or pw <Chicheng_Zhang-P29601@email.mot.com>
perlxstut: Example 1 (Jens M. Felderhoff)
Re: Problem with eval and lexical scoping (M.J.T. Guy)
Re: Problems with Win32::OLE <jeff@vpservices.com>
Re: Question About the last command (M.J.T. Guy)
Re: Question About the last command (M.J.T. Guy)
Re: Question from a starter <sariq@texas.net>
Re: RedHat Linux 6.0 and Perl 5.005_03 (Dan Wilga)
Re: Sorting weird numeric data (Abigail)
Re: Sorting weird numeric data <uri@sysarch.com>
Re: threads?? (M.J.T. Guy)
Re: threads?? <dan@tuatha.sidhe.org>
Re: toLowercase?? (M.J.T. Guy)
Why DBI ? Speed ? cuncua@yahoo.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 29 Sep 1999 16:56:22 GMT
From: "Test" <test@hhhd.com>
Subject: Re: #exec cgi
Message-Id: <WwrI3.1413$7S6.814@198.235.216.4>
Abigail, that's very mean of you.. if you do not know the answer, don't
answer !!
Try this directive.
<!--#include virtual="/yourfile.cgi?whatever=abc" -->
Thanks
Abigail <abigail@delanet.com> wrote in message
news:slrn7u9edr.2ml.abigail@alexandra.delanet.com...
> Magnus Hult (hult.holmstrom@swipnet.se) wrote on MMCCX September MCMXCIII
> in <URL:news:rC2F3.4067$yU2.8061@nntpserver.swip.net>:
> ''
> '' First of all, I know this is way off-topic, but I really need to get
this to
> '' work (and quite soon too).
>
> So, you think that posting an off-topic posting gets you a fast answer?
> How foolish.
>
> '' I'm trying to include a cgi program from an shtml page. My problem is,
I
> '' need to send a query string too. But
> '' <!--#exec cgi="script.cgi?query"-->
> '' isn't working, I get an "[an error occured while processing this
directive]"
> '' error.
>
> That means you have a bug.
>
>
>
> Abigail
> --
>
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47
]
>
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W
]
>
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^
V
> %$^U;$^V/=$^U}while$^V!=$^W'
>
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers
==-----
------------------------------
Date: 29 Sep 1999 17:51:46 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: $_ assignment
Message-Id: <7stjji$gsg$1@pegasus.csx.cam.ac.uk>
Danny Aldham <danny@hendrix.postino.com> wrote:
>X-Newsreader: TIN [version 1.2 PL2]
>
>I find I am constantly assigning values to $_ , like:
>$_ = $Domain ;
>s/\./_/g ;
>$Domain_Directory = $_ ;
>
>since so many commands, (like substitute) , assume you are working with $_ .
>What is the better way to do this, I know this is not right.
Others have pointed out the =~ operator.
But for cases where you want to do a *lot* of operations on
the *same* string, you might consider the foreach trick:
foreach ($string) {
s/.../.../; # these all operate on $string
m/.../;
$x = length;
chomp;
};
Mike Guy
------------------------------
Date: 29 Sep 1999 11:33:48 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: acos function
Message-Id: <slrn7v4g9q.avl.abigail@alexandra.delanet.com>
jmn.ac.delete@abanet.it (jmn.ac.delete@abanet.it) wrote on MMCCXX
September MCMXCIII in <URL:news:37f1edb6.0@etsv0008>:
%%
%% Has anyone a acos (cos-1, arccos) function for Perl.
%%
%% I am using NT.
%% I don't want to/can't(?) use POSIX acos.
%% I am aware of the standard series expansions.
%% I am aware of the standard polynomial approximations.
%% I am lazy.
Why can't you use POSIX acos, yet you can use someone elses work?
Or is acos on NT different from the rest of the world?
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)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Sep 1999 16:09:48 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: Advice wanted: Creating an .exe
Message-Id: <01bf0a95$4025fee0$3527e1ce@bill.jump.net>
William <bivey@teamdev.com> wrote in article
<01bf0a94$5e856020$3527e1ce@bill.jump.net>...
> Abigail <abigail@delanet.com> wrote in article
> <slrn7v2u50.9kl.abigail@alexandra.delanet.com>...
> > Wrong. Solution2 is to ship LWP as well. No Perl distribution comes
> > with LWP anyway.
>
> I believe _their_ current install package does include it, but,
> in any case, it's not an option (not my choice). It's moot since
> I now have two viable solutions (one I rolled yesterday, and one
> Mr. Schwartz kindly put me onto: wget). -Wm
Oops, statement ambiguity - the Schwartz there was Eric, not Randal,
David, etc. Credit where due, etc. -Wm
------------------------------
Date: Thu, 30 Sep 1999 02:18:09 +0930
From: spamfree@metropolis.net.au (Henry Penninkilampi)
Subject: Re: Advice wanted: Creating an .exe
Message-Id: <spamfree-3009990218100001@d5.metropolis.net.au>
In article <slrn7v2u50.9kl.abigail@alexandra.delanet.com>, Abigail
<abigail@delanet.com> wrote:
> No Perl distribution comes with LWP anyway.
Incorrect, the MacPerl distribution comes with LWP.
Henry.
------------------------------
Date: Wed, 29 Sep 1999 19:28:34 +0200
From: "Emulov" <emulov@NOSPAMsin.khk.be>
Subject: another newbie :)
Message-Id: <7sti82$bdr$1@xenon.inbe.net>
Hi.
I'm very new to Perl. I have experience in C/C++, VB, Cobol, and such. I
think the following may be often asked, so if there's a FAQ for this
newsgroup, with the answers, please just point me there.
1) I am having problems splitting a string.
Let's say I have a string "value=this is the value"
How can I put the part before '=' in a variable and everything behind it in
another? I tried 'split', but this doesn't work right if the there is more
than one '=' in the string.
2) Is there a way in Perl to check if a given URL exists?
3) And a way to go to an URL?
Thanx a lot!
Emulov.
------------------------------
Date: 29 Sep 1999 12:48:09 -0500
From: mah@everybody.org (Mark A. Hershberger)
Subject: Re: another newbie :)
Message-Id: <49905pa9t2.fsf@playpen.baileylink.net>
[mailed and posted]
"Emulov" <emulov@sin.khk.be> writes:
> 1) I am having problems splitting a string.
>
> Let's say I have a string "value=this is the value"
>
> How can I put the part before '=' in a variable and everything
> behind it in another? I tried 'split', but this doesn't work right
> if the there is more than one '=' in the string.
($key, $value) = split('=', $string, 2);
Next time, try "perldoc -f split":
If LIMIT is specified and is not negative, splits into no more
than that many fields (though it may split into fewer). If LIMIT
is unspecified, trailing null fields are stripped (which potential
users of pop() would do well to remember). If LIMIT is negative,
it is treated as if an arbitrarily large LIMIT had been specified.
> 2) Is there a way in Perl to check if a given URL exists?
>
> 3) And a way to go to an URL?
Look at LWP (http://www.linpro.no/lwp).
Hope that helps,
Mark.
------------------------------
Date: 29 Sep 1999 09:46:03 -0700
From: stevena@user2.teleport.com (Steven Alexander)
Subject: Re: Can in UNIX, But How in Perl
Message-Id: <7stfob$1o3$1@user2.teleport.com>
In article <37F229E6.4A925BB@ti.com>, Jerry Preston <g-preston1@ti.com> wrote:
>In UNIX I can do the following:
>
> cd */9181339
>
>and UNIX will change directory correctly.
>
>How can I do this in Perl.
Please read perlfaq8:
I {changed directory, modified my environment} in a perl
script. How come the change disappeared when I exited the
script? How do I get my changes to be visible?
Steven Alexander
stevena@teleport.com
<http://www.teleport.com/~stevena/>
------------------------------
Date: Wed, 29 Sep 1999 19:17:28 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Can in UNIX, But How in Perl
Message-Id: <37F249A8.29B6DBFD@ife.ee.ethz.ch>
Jerry Preston wrote:
>
> In UNIX I can do the following:
>
> cd */9181339
>
> and UNIX will change directory correctly.
>
> How can I do this in Perl.
The same way:
$_ = `cd */9181339`; chomp; chdir $_ or become_unhappy;
or you can do tricks with grep:
chdir @{[grep {-d} <*/9181339>]}[0] or start_to_scream;
------------------------------
Date: 29 Sep 1999 11:42:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: counting problem
Message-Id: <slrn7v4gqt.avl.abigail@alexandra.delanet.com>
Fulko van Westrenen (fulko@dizzy.ipo.tue.nl) wrote on MMCCXX September
MCMXCIII in <URL:news:slrn7v3q7r.1ge.fulko@dizzy.ipo.tue.nl>:
::
:: I want to know the sums of the different types. For this I made the
:: following code but it keeps giving me error messages about the counters.
:: Can anyone give me a hint on how to fix it?
Without telling us what the error message is?
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Sep 1999 11:31:21 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: deprecated $[
Message-Id: <slrn7v4g57.avl.abigail@alexandra.delanet.com>
Uri Guttman (uri@sysarch.com) wrote on MMCCXX September MCMXCIII in
<URL:news:x7iu4twwj3.fsf@home.sysarch.com>:
@@ >>>>> "TH" == Tracey Hughes <TH@Dymaxion.ca> writes:
@@
@@ TH> I was wondering if anyone knows why exactly the $[ variable was
@@ TH> deprecated after release 5.
@@
@@ can you think of a good reason to use it? the powers that be thought
@@ there was none and it was open to abuse.
Which raises the question, why was it ever introduced in the first place?
Abigail
--
$" = "/"; split $, => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Sep 1999 11:24:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Expert question: wrapping a subroutine
Message-Id: <slrn7v4fof.avl.abigail@alexandra.delanet.com>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCCXX September
MCMXCIII in <URL:news:7ssrij$9kg$1@lublin.zrz.tu-berlin.de>:
|| Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
||
|| >That doesn't work. All it does is *aliasing* &given_orig and &given. If
|| >you then redefine &given, &given_orig changes as well (-w will issue a
|| >warning). The above example leads to infinite recursion.
||
|| You are jumping to conclusions. Have you run a test?
Yes I did. And it lead to infinite recursion.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 30 Sep 1999 01:45:33 +0930
From: spamfree@metropolis.net.au (Henry Penninkilampi)
Subject: Re: Form to Mail Script on NT. How?
Message-Id: <spamfree-3009990145340001@d5.metropolis.net.au>
In article <37F2341F.41F26CB0@videosoftwareltd.com>, James Bodajlo
<james@videosoftwareltd.com> wrote:
> I am in need of a script which will work on an NT server and takes the
> info from an HTML form and sends it via e-mail. I have a script which
> works on UNIX, but I need to know what I need to change for it to work
> on NT.
Heh, heh...
You ask (what most folks would classify as) an NT-related question in
*this* newsgroup, demonstrate no evidence of having done any work to find
out the answer yourself, repost the same message 32 minutes later, and
don't even say 'please'?
Man, you're gonna regret that.
Sic him Abagail!
Henry.
------------------------------
Date: Wed, 29 Sep 1999 09:37:19 +0100
From: "Clyde Ingram" <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Subject: Re: Good Perl book
Message-Id: <938621230.27307.0.nnrp-12.9e98e5bc@news.demon.co.uk>
Even better is the O'Reilly Perl CD which has 6 Perl books, including the
twoMark quite rightly recommends. Plus Perl Cookbook, Advanced Perl, Perl
on Win32, and Perl in a Nutshell. They throw in a paper copy of the
Nutshell book too, with the CD.
A great combination. Easy to browse on hyperlinks across all 6 titles,
making up for some of the deficiencies in the indexes in the paper versions
of these books,
Regards,
Clyde
Me <NOSPAMmark@nl.gxn.net> wrote in message
news:7ssflm$8ik$1@blue.nl.gxn.net...
> Learning Perl and Programming Perl
> by O'reilly Publishers
>
> --
> Mark Spring GX Networks B.V.
> email: mark@nl.gxn.net Televisieweg 2
> tel: +31 36 5462400 1322 AC Almere
> fax: +31 36 5462424 The Netherlands
>
> Stephen Cui <yosho@hi.net> wrote in message
> news:MPG.125b30b5ca50a39c989680@news.hi.net...
> > Can anyone recommend a great PERL book to start with and get good at? I
> > got a coupon for barnesandnoble.com that expires on the 30th and would
> > like to get me a good book..
> >
> > Thanks in advance..
> > Stephen Cui
> >
> > yosho@hi.net
>
>
------------------------------
Date: Wed, 29 Sep 1999 09:17:09 -0700
From: Chicheng Zhang <Chicheng_Zhang-P29601@email.mot.com>
Subject: Re: How to convert perl file into binaries?
Message-Id: <37F23B85.CDDAAC26@email.mot.com>
David,
I do need convert a perl file into binaries, the cases are:
as a root, sometimes we write a new application(command) in perl but don't
want it to be readable but executable by users.
chmod +s it, is a solution to my knowledge.
Thanks for Hyma telling me that actually perl2exe supports UNIX platform too!
David Cassell wrote:
> Chicheng Zhang wrote:
> >
> > When running a perl file with shebang #!, I need +rx it(chmod 555). So
> > it is still reable. if I want
> > it to be unreadable but still executable, all I know is +s it. Is
> > there any simply way just convert
> > this file into binaries??
>
> Based on what you say, it doesn't sound to me like you really
> want or need to convert any files into binaries. If you don't
> want others to be able to read your CGI scripts, then that is
> usually a webserver config issue. If the web server is set up
> properly, visitors shouldn't be able to read your scripts.
>
> And I would recommend chmod 0755 instead, as per the CGI
> Programming FAQ at
> http://www.webthing.com/tutorials/cgifaq.html
>
> David
> --
> David Cassell, OAO cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician
------------------------------
Date: Wed, 29 Sep 1999 19:05:06 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: hyperlink submits
Message-Id: <Pine.HPP.3.95a.990929190112.16629N-100000@hpplus01.cern.ch>
On Wed, 29 Sep 1999, Michael Frost jeopardized the group with:
> The syntax is: <A
> HREF="http://your.domain/<path>/filename.cgi?parameter1=value1¶meter2=
^
Invalid HTML syntax. You need to represent ampersand as & in this
kind of HTML attribute value.
(yes, I chopped off the end of the long line. That wasn't the point).
------------------------------
Date: Wed, 29 Sep 1999 18:06:42 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Insert blank line between two lines?
Message-Id: <37F23912.B87E05F0@ife.ee.ethz.ch>
Mark A. Hershberger wrote:
> > I have a bunch of lines (my CD list actually) and I want to put a new
> > line between lines that have a different first character. For example
> > the original file would look like:
> Hmm.. Hashes and split are your friend.
>
[completely different code snipped]
>
> That should do it.
Wow, you managed to do something different than he asked, make
assumptions about the way his file looks, and even unsort it while it
was previously sorted. And all this in just a few lines.
I still like my solution better.
- Alex
------------------------------
Date: 29 Sep 1999 11:54:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Insert blank line between two lines?
Message-Id: <slrn7v4hh3.avl.abigail@alexandra.delanet.com>
Jason T. Breitweg (Jason.Breitweg@blind-guardian.com) wrote on MMCCXX
September MCMXCIII in <URL:news:tkud7v1x4z1.fsf@zussun8.desy.de>:
||
|| I have a bunch of lines (my CD list actually) and I want to put a new
|| line between lines that have a different first character.
#!/opt/perl/bin/perl -w
use strict;
my $prev = <>;
exit unless defined $prev;
print $prev;
my $curr;
while (defined ($curr = <>)) {
print "\n" if substr ($prev, 0, 1) ne substr ($curr, 0, 1);
print $curr;
$prev = $curr;
}
__END__
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)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 29 Sep 1999 13:55:34 -0400
From: Matt <mck@iag.net>
Subject: Re: Installing ActiveState 51X and PPM
Message-Id: <J1LyN2BeOFHxAuFrjLgvdTH1OrE4@4ax.com>
I am getting the same problem. Apparently the access violation occurs
in InstallShield, and is not unique to ActivePerl. A search on
deja.com shows others getting the error in _INS0432._MP.
Have you been able to solve it?
On Tue, 07 Sep 1999 23:16:11 GMT, nick@xyvision.com wrote:
>Hello all:
>
>I am running NT4.0, Service Pack 5.
>
>I am having a no doubt familiar, though not very discussed problem
>installing ActiveState 515,6,7,, and 9!
>
>While the install is configuring perl ("This may take a few minutes"),
>the install crashes and Dr. Watson prints the log message about an app
>error in _INS0432._MP.EXE, Exception: access violation, etc.
>
>Well, perl is incompletely installed, but I can still run things after
>doing some manual setup (i cannot however run uninstall).
>
>Then, to install Tk, I attempt to use PPM, but it cannot find the
>PPM_DAT file. I try the various hints lying about, to no avail.
>
>here is the log of my attempts:
>
>G:\Perl\site\lib>ppm genconfig > ppm.xml
>
>G:\Perl\site\lib>ppm install Tk
>Failed to load PPM_DAT file
>Error installing package 'Tk': Could not locate a PPD file for package
>Tk
>
>G:\Perl\site\lib>ppm install
>http://www.activestate.com/packages/zips/Tk.ppd
>Failed to load PPM_DAT file
>Error installing
>package 'http://www.activestate.com/packages/zips/Tk.ppd': Coul
>d not locate a PPD file for package
>http://www.activestate.com/packages/zips/Tk.
>ppd
>
>G:\Perl\site\lib>ppm install http://www.activestate.com/packages/zips/Tk
>Failed to load PPM_DAT file
>Error installing package 'http://www.activestate.com/packages/zips/Tk':
>Could no
>t locate a PPD file for package
>http://www.activestate.com/packages/zips/Tk
>
>G:\Perl\site\lib>ppm install
>http://www.activestate.com/packages/zips/Tk.zip
>Failed to load PPM_DAT file
>
>not well-formed at line 1, column 2, byte 2 at
>g:/Perl/site/lib/XML/Parser.pm li
>ne 153
>
>G:\Perl\site\lib>
>G:\Perl\site\lib>
>
>Thanks for any assistance. (PS It is a bit urgent).
>
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
------------------------------
Date: 29 Sep 1999 12:00:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: kill extra white space in a variable
Message-Id: <slrn7v4hr3.avl.abigail@alexandra.delanet.com>
Casey R. Tweten (crt@kiski.net) wrote on MMCCXX September MCMXCIII in
<URL:news:Pine.OSF.4.10.9909291102480.4735-100000@home.kiski.net>:
--
-- You don't need two lines. Can we add this to the FAQ?
--
-- $_ = ' space space ';
-- s/(^\s*|\s*$)//g;
No, as that's less efficient and less clear than the 2 liner.
But we might want to add to the FAQ why this isn't a good idea...
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 29 Sep 1999 13:31:36 -0400
From: "Casey R. Tweten" <crt@kiski.net>
Subject: Re: kill extra white space in a variable
Message-Id: <Pine.OSF.4.10.9909291253200.12482-100000@home.kiski.net>
On 29 Sep 1999, Colin R. DeVilbiss wrote:
:Casey R. Tweten <crt@kiski.net> wrote:
:> On Wed, 29 Sep 1999, Tom Briles wrote:
:
:> :David Amann wrote:
:
:> :$string =~ s/^\s+//;
:> :$string =~ s/\s+$//;
:
:> You don't need two lines. Can we add this to the FAQ?
:
:> $_ = ' space space ';
:> s/(^\s*|\s*$)//g;
:
:see the faq for why NOT to do this. :)
I am aware of that entry, however, it has never bothered me before, and I
don't to replacement. It does fail on newlines, however, the origional
delema was:
:>> I get the array from a flat text file, and so far there is only one
:>> item that should be in the array, an image name called "one.gif".
:>>
:>> ... there is a space that gets put on the end of the variable, so when
:>> I try to add an extension onto the name such as ".data", it gives me
:>> the value:
:>>
:>> one.gif .data
so, if that is the value he recieved, that tells us there is no new line,
and the regex i supplied will not fail.
Just for kicks, I did a benchmark. At 1_000_000 iterations, the
difference is outrageous. I would never do it with the above regex.
However, at 1_000 iterations, which sounds more like this guys needs, at
the highest level, the difference is about 2 times, of course, it is still
under a second, and hardly noticeable.
To be honest, even if this guy ever has 1_000 lines in this text file, he
is nuts, and should have a database. That doesn't help the regex speed,
but his decision to use a flatfile tells me that (hopefully) he doesn't
plan on this many lines.
#!/usr/local/bin/perl -w
use strict;
$|++;
use Benchmark;
timethese(1_000_000, {
'Mine' => sub {
$_ = ' space space ';
s/(^\s*|\s*$)//g;
},
'FAQ4' => sub {
$_ = ' space space ';
s/^\s+//;
s/\s+$//;
},
});
timethese(1_000, {
'Mine' => sub {
$_ = ' space space ';
s/(^\s*|\s*$)//g;
},
'FAQ4' => sub {
$_ = ' space space ';
s/^\s+//;
s/\s+$//;
},
});
have fun!
--
Casey R. Tweten <joke> This
Web Developer is 100% certified
HighVision Associates virus and bug
crt@highvision.com free code. </joke>
------------------------------
Date: 29 Sep 1999 17:34:38 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Match and escape processing
Message-Id: <7stije$g33$1@pegasus.csx.cam.ac.uk>
Ala Qumsieh <aqumsieh@matrox.com> wrote:
>
>Brett.A.Hunsaker@usace.army.mil writes:
>
>> A simple question - I would think the following statement would
>> always be true:
>>
>> $xyz =~ m/$xyz/
>
>I can see how a newbie would easily be fooled by this. But, as you
>discovered, special vars in $xyz will throw you off. You have to
>disable the special meaning of those vars. The following, however,
>will always be true:
>
> $xyz =~ /\Q$xyz/;
>
>Read perlre for more info.
And while you're about it, think carefully whether you want that test
anchored:
$xyz =~ /^\Q$xyz$/;
And also, if you just want to test strings for equality, the 'eq'
operator may be more appropriate.
Mike Guy
------------------------------
Date: Wed, 29 Sep 1999 18:34:50 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: newbie help: sorting multidimensional arrays
Message-Id: <37F23FAA.B9926C88@ife.ee.ethz.ch>
Patrick Smith wrote:
>
> Hi,
>
> I'm kind of new to this. I need to know if there is a way to sort a
> multidimensional [10,5] array using the first element of each row as the
> sorted item and keeping the other 4 elements of the row in origional
> order together with the first element after having sorted all ten rows.
> All the elements will be numbers.
1. create a hash with the first element as key and a ref to the original
array entry as value. Preserve the order of the refs
2. sort the hash keys
3. for the sorted hash keys, give out the original contents in order
my %th; #temporary hash
@sortedarray = map {@{delete $th{$_}||[]}}
sort
map {push @{$th{$$_[0]}}, $_; $$_[0]} @a;
Can this still count as ST?
Note: Due to the map sort map construct, there are more elements in the
sort than necessary. That's the reason for the 'delete or empty list
ref' construct. I did it this way because I couldn't resist the 'map
sort map' :-)
- Alex
------------------------------
Date: Wed, 29 Sep 1999 09:53:41 -0700
From: Chicheng Zhang <Chicheng_Zhang-P29601@email.mot.com>
Subject: Re: Perl Telnet to a system not needing login id or pw
Message-Id: <37F24415.48A24B24@email.mot.com>
I encountered this problem too, what I did is comment out the login
line, directly call cmd(), so
if you are using telnet.pm,
$t= new Net::Telnet;
$t->open(remote_host);
$t->cmd("........");
It works for me.
Jay Baker wrote:
> Has anyone tried this? I have a need to
> do so, but have not been
> successful. The problem is that I need
> the IP address and port, but
> no userid or password to pass the
> "login" method. When I telnet
> into the machine manually, I don't need
> a
> userid/password. But apparently
> the telnet Perl package requires I give
> it something in the login
> call. Any ideas?
>
> I am new to Perl prog... so please be
> gentle!
>
> Jay
------------------------------
Date: 29 Sep 1999 18:21:11 +0200
From: jmfelder@baan.com (Jens M. Felderhoff)
Subject: perlxstut: Example 1
Message-Id: <pbyadplmdk.fsf@srv-deu-cos11.baan.com>
When I tried Example 1 from perlxstut, I got the following error
message when I ran make:
mkdir ./blib
mkdir ./blib/lib
mkdir ./blib/arch
mkdir ./blib/arch/auto
mkdir ./blib/arch/auto/Mytest
mkdir ./blib/lib/auto
mkdir ./blib/lib/auto/Mytest
cp Mytest.pm ./blib/lib/Mytest.pm
/usr/local/bin/perl -I/opt/perl5/lib/PA-RISC2.0/5.00404 -I/opt/perl5/lib /opt/perl5/lib/ExtUtils/xsubpp -typemap /opt/perl5/lib/ExtUtils/typemap Mytest.xs >Mytest.tc && mv Mytest.tc Mytest.c
Please specify prototyping behavior for Mytest.xs (see perlxs manual)
gcc -c -D_HPUX_SOURCE -I/usr/local/include -O -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -I/opt/perl5/lib/PA-RISC2.0/5.00404/CORE Mytest.c
In file included from /opt/perl5/lib/PA-RISC2.0/5.00404/CORE/perl.h:271,
from Mytest.xs:5:
/opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.7.2.3/include/string.h:24: warning: conflicting types for built-in function `memcmp'
/opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.7.2.3/include/string.h:28: warning: conflicting types for built-in function `strcpy'
/opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.7.2.3/include/string.h:31: warning: conflicting types for built-in function `strcmp'
/opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.7.2.3/include/string.h:76: warning: conflicting types for built-in function `memcpy'
Mytest.xs:11: parse error before `:'
Mytest.xs:15: initializer element is not constant
Mytest.xs:15: register name not specified for `mark'
Mytest.xs:15: initializer element is not constant
Mytest.xs:15: `sp' undeclared here (not in a function)
Mytest.xs:15: initializer element is not constant
Mytest.xs:16: parse error before `if'
Mytest.c: In function `boot_Mytest':
Mytest.c:45: `XS_Mytest_hello' undeclared (first use this function)
Mytest.c:45: (Each undeclared identifier is reported only once
Mytest.c:45: for each function it appears in.)
gmake: *** [Mytest.o] Error 1
The (first) line the compiler was complaining about is:
PROTOTYPES: DISABLE
in Mytest.xs which also appears in the C source file.
I assume that somehow the line is not preprocessed by Perl (cf. the
line that croaks about specifying the prototyping behavior).
I get the same behavior running on a Linux system (SuSE 6.1).
Cheers
Jens
--
Jens M. Felderhoff -- Baan Company, BaanWise Workflow
office: jmfelder@baan.com
home : j.m.f@netcologne.de
------------------------------
Date: 29 Sep 1999 17:45:05 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problem with eval and lexical scoping
Message-Id: <7stj71$gm8$1@pegasus.csx.cam.ac.uk>
Cody Jones <ua025@vtn1.victoria.tc.ca> wrote:
>
>It fails with the error "Global symbol "x" requires explicit package name
>at (eval 2) line 1." I am using 5.004_04. The second eval is being
>executed in the same scope as "my $x = 1", so why can't it see $x?
It fails under perl5.004_04, but is OK under the latest perl5.004
maintenance release (perl5.004_05) and also under perl5.005_03.
So the answer is: upgrade.
Mike Guy
------------------------------
Date: 29 Sep 1999 15:48:01 GMT
From: Jeff Zucker <jeff@vpservices.com>
To: Christian Habermehl <Christian.Habermehl@fhtw-berlin.de>
Subject: Re: Problems with Win32::OLE
Message-Id: <37F232E9.64254244@vpservices.com>
Christian Habermehl wrote:
>
> At the following commands the program stops and has to be cancelled.
>
> $MyCommand->{ActiveConnection} = $DatabaseConnection;
> $TestRecord = $DatabaseConnection->Execute("SELECT * FROM testtable");
>
> Do you know, how I can prevent that errors (the variables were
> initialized correctly and the database-connection worked some lines in
> code before)?
Same advice as before: use error checking to find out what is going
wrong. Change those lines to:
$MyCommand->{ActiveConnection} = $DatabaseConnection
or die Win32::OLE->lastError();
$TestRecord = $DatabaseConnection->Execute("SELECT * FROM testtable");
or die Win32::OLE->lastError();
And use lastError() anytime you do something with the database that
might fail (which is most things).
BTW, is "$x->{ActiveConnection} = $y" really what is called for? Seems
like a rather rude invasion of the privacy of the object's internals.
--
Jeff
------------------------------
Date: 29 Sep 1999 17:07:57 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Question About the last command
Message-Id: <7sth1d$f2k$1@pegasus.csx.cam.ac.uk>
In article <7soft2$5ee$4@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>In article <7sod82$mpo$1@nnrp1.deja.com>,
> reedjd@bitsmart.com writes:
>
>: TEST: {
>: $LET = "A",
>: last TEST if $HOSTNAME eq "http://www.yahoo.com";
>: $LET = "B",
>: last TEST if $HOSTNAME eq "http://www.excite.com";
>: }
>:
>: So my question about this is... are the assign statements being run
>: before the last statement, or after?
>
>Did you read the docs? Did you try some simple test cases?
That's a bit unfair. Although everyone agrees that , in a scalar
context should be evaluated left-to-right, that isn't currently
documented. And for operators in general (including , in a list
context) the order is definitely *not* defined.
And testing isn't much help. It'll tell you that it *sometimes* works,
but a serious QA person would want to know whether it *always* works.
As Dijkstra pointed out, testing proves the presence of bugs, not their
absence.
Mike Guy
------------------------------
Date: 29 Sep 1999 17:22:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Question About the last command
Message-Id: <7sths4$fje$1@pegasus.csx.cam.ac.uk>
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>In article <7soft2$5ee$4@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>>
>>Did you read the docs? Did you try some simple test cases?
>
>That's a bit unfair. Although everyone agrees that , in a scalar
>context should be evaluated left-to-right, that isn't currently
>documented.
Ooops. Just after I posted that, I see another post from Greg
which quotes where it *is* documented.
Sorry.
Mike Guy
------------------------------
Date: Wed, 29 Sep 1999 12:12:06 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Question from a starter
Message-Id: <37F24866.3A432E65@texas.net>
Ivo Swartjes wrote:
>
> I was wondering how a multidimensional array is created in Perl (something
> like @name=((a,b),(c,d),(e,f)) ? ) and how I can access say the second
> element of the third subarray (which is f in this case)...someone said
> something like $value = @name{3}{2} but that doesn't work...I've tried
> @name[3,2] too, without good results
>
> Hope someone can help me in this
> Ivo
Firstly, please read:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
which deals with Choosing Good Subject Lines.
Secondly, there's a wealth of information at your fingertips.
Try:
perldoc perldoc
perldoc perl
perldoc perltoc
Then, you can read all about data structures in the Perl Data Structures
Cookbook:
perldoc perldsc
- Tom
------------------------------
Date: Wed, 29 Sep 1999 11:55:15 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: RedHat Linux 6.0 and Perl 5.005_03
Message-Id: <dwilgaREMOVE-2909991155150001@wilga.mtholyoke.edu>
In article <RGoI3.54$SS2.2304@dfw-read.news.verio.net>, "news.way.com"
<mccomb@clubplanet.com> wrote:
> Basically, if the script starts with
>
> #!/usr/bin/perl
>
> when I execute the script I get a "command not found" error message. If the
> script starts with:
>
> !#/usr/bin/perl -w
I assume you mean #!/usr/bin/perl -w
> the script runs as expected. Any ideas?
>
>
> Also, trying to execute a chmod command from within a CGI script does not
> seem to do anything, but when run from a shell it executes correctly.
Is it possible that you have the wrong kind of carriage returns in the
file? Was it created on a Mac? Try doing a "head" on the file and see if
it looks mangled when displayed to the terminal screen.
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: 29 Sep 1999 11:30:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Sorting weird numeric data
Message-Id: <slrn7v4g2p.avl.abigail@alexandra.delanet.com>
Uri Guttman (uri@sysarch.com) wrote on MMCCXX September MCMXCIII in
<URL:news:x7u2odwxpt.fsf@home.sysarch.com>:
,, >>>>> "A" == Abigail <abigail@delanet.com> writes:
,,
,, A> Unsigned chars? That's the *problem*. It's not Perl. Perl has
,, A> scalars. Unsigned chars is C. If I would want to code in C, I know
,, A> where to get it. I prefer coding in Perl.
,,
,, but if you want speed, you have to go there. pack is not XS coding, but
,, perl accessing the machine layer for precise data control and speed. our
If I want speed that much, I wouldn't use Perl to start with.
,, sort method takes advantage of that for its speed. if you don't care
,, about sort speed, stick with the ST and variants. i am not stopping
,, you. but for such an algorithmic person always quoting knuth, i would
,, think you would embrace the speed up over the higher level perl
I do not care much for the constant. Never did. I am always interested
in the asymptotic bounds though.
,, code. larry showed a 3 time improvement over your sort and that will
,, grow with the size of the dataset.
Oh? Your sorting algorithm beats O (N log N)?
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Sep 1999 13:46:02 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Sorting weird numeric data
Message-Id: <x7emfhwqzp.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@delanet.com> writes:
A> If I want speed that much, I wouldn't use Perl to start with.
but if the sort in perl is a bottleneck, this is a way out. why even use
ST as you do and instead just recompute everything in the sort sub?
because you care about speed at some level. within perl our sort is
faster. outside of perl it is moot.
A> I do not care much for the constant. Never did. I am always
A> interested in the asymptotic bounds though.
in the real world, the constant matters too. in the theoretical world it
is ignored. our sort lives in the real world. it is not a theoretical
approach but a practical way to make your sorts run faster. many people
have commented on how thay like the idea and the paper. i am not arguing
theoretical stuff, i did that in my algorithms class to omany years ago
(taught by rivest of rsa).
A> ,, code. larry showed a 3 time improvement over your sort and that
A> will ,, grow with the size of the dataset.
A> Oh? Your sorting algorithm beats O (N log N)?
not exactly but your code grows with O(N log N) as it is inside the
compare code. the GRP preprocesses in O(N) so it grows more slowly. this
means as the dataset grows larger there will be a larger real world
speed ratio between yours and our even though both have O(N log N) as
their main order.
perl is a practical language as you well know for solving real world
problems. real times of sorts are a real problem. our sort tackles that.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 29 Sep 1999 17:16:59 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: threads??
Message-Id: <7sthib$fg0$1@pegasus.csx.cam.ac.uk>
Kragen Sitaker <kragen@dnaco.net> wrote:
>In article <37F103F9.9843EDE6@americasm01.nt.com>,
>Marshall Culpepper <marshalc@americasm01.nt.com> wrote:
>>$done = 0;
>>
>>$SIG{'CHLD"} = {$done = 1}
>
>This is wrong in two ways. One is that it contains an unterminated
>''-delimited string with a " in it, but perl would have told you that
>if you had tested it like you said you did. The other is that when you
>run it, it executes the block, which means executing the statement
>{$done = 1}, which sets $done to 1. Then it takes the return value of
>that statement (1) and returns that as the value of the block. Then it
>assigns that to $SIG{'CHLD'}, which isn't going to do you any good; 1
>is generally one of the special signal things like SIG_IGN or SIG_DFL.
>
>You want sub {$done = 1}, I think.
It's wrong in a much more fundamental way. The $SIG{CHLD} must
do a wait() for the child process, else you'll get loops and/or zombies.
See perlipc for examples, and discussion of the complications
associated with $SIG{CHLD}.
Mike Guy
------------------------------
Date: Wed, 29 Sep 1999 17:44:57 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: threads??
Message-Id: <tesI3.1129$S32.1868@news.rdc1.ct.home.com>
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
> It's wrong in a much more fundamental way. The $SIG{CHLD} must
> do a wait() for the child process, else you'll get loops and/or zombies.
The original, which got chopped out in the replies, did wait. It just
didn't wait inside the signal handler.
Dan
------------------------------
Date: 29 Sep 1999 17:10:11 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: toLowercase??
Message-Id: <7sth5j$f4m$1@pegasus.csx.cam.ac.uk>
Abigail <abigail@delanet.com> wrote:
>
>That would be cheating. Besides, what do you do if your lc function breaks,
>on a late Saturday evening, and everything is closed?
Oh, that's easy. I'd give up and go to the pub.
Mike Guy
------------------------------
Date: Wed, 29 Sep 1999 17:48:50 GMT
From: cuncua@yahoo.com
Subject: Why DBI ? Speed ?
Message-Id: <7stjdt$dkg$1@nnrp1.deja.com>
Sorry for this question but I´m a newbie.
I was testing many linux RDBMS (mSQL, MySQL and PostgreSQL), then I
installed the DBI modules, and they work as supposed (good).
Before that I was accessing to the databases throw shell scripts using
the shell interfaces which come with the packages and the traditional
text utilities (awk, sed, tr, etc).
What I found? The hard way works 10 times faster than the DBI way for
my system.
Conclusion : I´m using perl for handle and display data but the access
to the database is made via shell.
So, I am missing something or the DBI only brings easy use ?
Thanks a lot.
Cuncua.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 V9 Issue 944
*************************************