[13317] in Perl-Users-Digest
Perl-Users Digest, Issue: 727 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 7 05:07:22 1999
Date: Tue, 7 Sep 1999 02:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 7 Sep 1999 Volume: 9 Number: 727
Today's topics:
Re: Can Perl Do It?. . . . <jpeterson@office.colt.net>
Re: case for open lang on win32 - fill in the table <gellyfish@gellyfish.com>
Re: Does Perl have regexpr macros? (Douglas Wilson)
Re: Emacs Freezes Editing Perl Scripts (Kai Großjohann)
Re: Emacs Freezes Editing Perl Scripts <gellyfish@gellyfish.com>
Help please with script running problem (Wayne Webber)
Re: How to make a dynamically updating Tk page? (There are no visible exits.)
Re: How to make a dynamically updating Tk page? <gellyfish@gellyfish.com>
Re: How to match as most as possible ? marcza@my-deja.com
Re: How to match as most as possible ? marcza@my-deja.com
I'm not as lazy as I could be... (Sean McAfee)
Re: mysql interview <synced@austin.rr.com>
Re: mysql interview (Andrew Johnson)
Re: Pattern substitution <agray@infoscience.otago.ac.nz>
Re: Pattern substitution (Larry Rosler)
Re: perl mail filter? (Sean McAfee)
Re: Problem with <!--#exec cgi=/scripts/script.pl%22--> <wyzelli@yahoo.com>
Re: Problem with <!--#exec cgi=/scripts/script.pl%22--> (Abigail)
reading complex data from a file (Peter Bismuti)
Re: Select Multiple Form Field via Perl into Oracle err <jimcr@bwn.net>
Re: Subscribing to p5p <jll@enterprise.newedgeconcept>
Re: Subscribing to p5p (brian d foy)
suggestion to revise grep (another Q: reference compari <johnlin@chttl.com.tw>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 07 Sep 1999 08:59:25 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Can Perl Do It?. . . .
Message-Id: <Nt4B3.79$xa4.1094@news.colt.net>
In comp.lang.perl.misc Larry Bottorff <mrprenzl@midusa.net> wrote:
> Hello,
> nice--if your browser is one of the 4.0's. The big $64k question is, can
> I do such a huge Web project in Perl? With our VB app the user goes
> through scores of forms, i.e., this is a long, sustained data management
> task. In addition, come tax crunch time, such a site will get
> potentially mega hits. What do you think about Java servlets,
> Python/ZOPE? BTW, what do the grown-ups use, i.e., Excite, Yahoo? How do
Java servlets are good, so long as you have a good Java programmer or two.
> I argue against MS/ASP/IIS etc.etc.? If Perl, then what strategy to
> avoid the old CGI max-out? Is a Linux/Apache/Perl solution solid
> security-wise? I have this silly dream of staying clear of SatanWare. .
CGI is not good, probably, for your scenario. Check out mod_perl for Apache or
Velocigen, both ways to accelerate CGI via caching, shared data connections
and so forth.
Yes, Perl can do what you want. The question is whether you can do what you
want with Perl. That depends heavily on your personel. Do you have at least
two good Perl programmes who are very familiar with OOP, Apache, HTTP and so
forth? Are both those people going to stay at the company for the duration of
the project?
What about the Windows side? Chances are at least some of your NT systems will
co-exist with the new web systems for a while. Do you have Perl programmers
familiar with Win32? Will Java's inability to access COM be a problem?
It's all down to manpower.
------------------------------
Date: 7 Sep 1999 09:33:34 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: case for open lang on win32 - fill in the table
Message-Id: <37d4cdde_1@newsread3.dircon.co.uk>
In comp.lang.perl.misc Jason Kohlhoff <jwk6@earthlink.net> wrote:
> I have something to add...
>
> You Perl guys are all full of "open" shit...
>
> I doubt you could write a script for a Windows machine that could not be
> done(possibly even better) with WSH and VBS, or JS.
>
I have one word for you shit-for-brains and that is 'bollocks'.
If you want to start a flame war it is better that you start off at least
with some semblance of a defensible position.
[followups set]
/J\
--
"The teenage masturbators of today are the television executives of
tomorrow" - Melissa Cabriolet, Drop the Dead Donkey
------------------------------
Date: Tue, 07 Sep 1999 03:29:12 GMT
From: dwilson@gtemail.net (Douglas Wilson)
Subject: Re: Does Perl have regexpr macros?
Message-Id: <7r28gg$l5h$1@nntp.Stanford.EDU>
On Thu, 02 Sep 1999 11:43:12 -1000, David Pautler <letsgo_7@lava.net> wrote:
>Does Perl have regexpr macros like those of Lex? For example, I would
>like to define this,
>
> word_style ( </?B> | </?I> )
>
>and use it like this:
>
> m| {word_style} (.*?) {word_style} |six
Check out the perlop man pages and the relatively new
qr/.../ operator. It may be just what you want.
$word_style=qr/(<\?B>|<\?I>>)/;
....
Cheers,
Douglas Wilson
------------------------------
Date: 07 Sep 1999 09:35:05 +0200
From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann)
Subject: Re: Emacs Freezes Editing Perl Scripts
Message-Id: <vafr9kbb2dy.fsf@lucy.cs.uni-dortmund.de>
hile@cse.psu.edu (Coy A Hile) writes:
> best solution i know of is NOT to use Emacs. Use pico or vi instead
"The engine of my car keeps having problems."
"Ride a bike, then, no more engine problems, ever!"
I'm sure that pico and vi are nice programs, but their functionality
does not compare with Emacs, and thus they are not good substitutes
for Emacs.
kai
--
I like BOTH kinds of music.
------------------------------
Date: 7 Sep 1999 09:46:12 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Emacs Freezes Editing Perl Scripts
Message-Id: <37d4d0d4_1@newsread3.dircon.co.uk>
In comp.lang.perl.misc Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> wrote:
> hile@cse.psu.edu (Coy A Hile) writes:
>
>> best solution i know of is NOT to use Emacs. Use pico or vi instead
>
> I'm sure that pico and vi are nice programs, but their functionality
> does not compare with Emacs, and thus they are not good substitutes
> for Emacs.
>
The best solution is not to get into editor advocacy wars in a Perl newsgroup.
[followups set]
/J\
--
"Malcolm, what have I told you about putting chocolate near your
crotch?" - Mrs Merton
------------------------------
Date: Tue, 07 Sep 1999 06:39:50 GMT
From: webber@excite.com (Wayne Webber)
Subject: Help please with script running problem
Message-Id: <7r2c0s$501@news.hsonline.net>
I have a perl script which:
1. accepts form input
2. emails me the form data
3. emails the user a confirmation note
4. generates a confirmation html page
I have another script in which #4 above simply returns them to a
different url.
When *I* run the scripts as a user, *I* get the emails but an error
when it tries either to return me to a page or generate a page.
When others around the country test it, THEY get everything as
intended.
Needless to say, this makes it mighty difficult for me to test
anything during the coding process.
These same scripts have not changed and used to work for me. My host
says the problem is not on their end.
What HAS changed is my phone connection. It has been much slower than
normal and I have been having a lot of static and noise on the line,
so there is a lot of error-hecking going on.
Is there any sort of automatic timeout or reason why a bad connection
would make the return part of the script fail???????????????????
Any help would be greatly (if non-monetarily) appreciated.
------------------------------
Date: 7 Sep 1999 08:45:27 GMT
From: mhannine@news.abo.fi (There are no visible exits.)
Subject: Re: How to make a dynamically updating Tk page?
Message-Id: <7r2jb7$mt7@josie.abo.fi>
ljp (llornkcor@llornkcor.com) wrote:
: how about using
: <meta http-equiv="refresh" content="0; url=whateverThisPageIsCalled.html">
:
He said Tk. I don't think showing him some html will help :)
/Mika
--
"See, it's an IBM pen."
"That's nice. Of course that means it's incompatible with
most kinds of paper." -- Ted and Kevin Cherkauer
------------------------------
Date: 7 Sep 1999 10:01:34 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to make a dynamically updating Tk page?
Message-Id: <37d4d46e_1@newsread3.dircon.co.uk>
There are no visible exits. <mhannine@news.abo.fi> wrote:
> ljp (llornkcor@llornkcor.com) wrote:
> : how about using
> : <meta http-equiv="refresh" content="0; url=whateverThisPageIsCalled.html">
> :
>
> He said Tk. I don't think showing him some html will help :)
>
But of course as eny fule kno that PERL is only used for writing CGI scripts
the original poster must have been mistaken when he mentioned Tk.
/J\
--
"Buzz Aldrin was the second man to walk on the moon and the first to
fill his pants" - Violet Berlin, The Big Bang
------------------------------
Date: Tue, 07 Sep 1999 07:56:46 GMT
From: marcza@my-deja.com
Subject: Re: How to match as most as possible ?
Message-Id: <7r2gfr$2k9$1@nnrp1.deja.com>
In article <7qoasc$ipi$1@holly.prod.itd.earthlink.net>,
"Ken Hirsch" <kenhirsch@myself.com> wrote:
>
> <marcza@my-deja.com> wrote:
> > Assume the following code:
> >
> > $A[3] = "one";
> > $A[7] = "two";
> > $A[73] = "three";
> >
> > $text = "aAbb3a abaA3baaaAAA bAA77aabA73aa\n";
> > $text =~ s/(A([0..73]{1,2}))/$A[$2]/g;
> >
> > print "OUT=$text#$1#$2#$3#\n";
> >
> > In the example A3 and A7 is replaced as desired
> > but A73 is replaced with $A[7] instead of $A[73].
> >
> > How can I perform maximal matching ?
> >
> > Bye
> >
> > Marcus
> No.
> Perl already does maximal matching. In your example,
> A3 is replaced by $A[$3]
> A77 is replaced by $A[77]
> A73 is replaced by $A[73]
>
> The actual output from your example is:
> OUT=aAbb3a abaonebaaaAAA bAaabthreeaa
> #A73#73##
>
> Note: The regular expression [0..73] matches the characters 0, 3, 7,
or
> period '.' It is the same as [.037], not at all what is implied by
your
> notation.
Sorry, you misunderstood me. When I said "maximal possible" matching
I meant it regarding the array. The maximal (=last) element of the
array is $A[73]. So $A[77] should NOT be matched. Instead $A[7]
should be taken. The desired output is
OUT=aAbb3a abaonebaaaAAA bAtwo7aabthreeaa
Concerning the syntax of ...A[0..73].. I know that this expression
is interpretated as you mentioned. This was only a "pseudo" syntax
to show a "similar" wish-to-have syntax.
I am searching a correct perl replacement.
Thank you
Marcus
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 07 Sep 1999 08:01:56 GMT
From: marcza@my-deja.com
Subject: Re: How to match as most as possible ?
Message-Id: <7r2gpf$2n3$1@nnrp1.deja.com>
Sorry, you misunderstood me the same way as Ken.
When I said "maximal possible" matching
I meant it regarding the array. The maximal (=last) element of the
array is $A[73]. So $A[77] should NOT be matched. Instead $A[7]
should be taken. The desired output is
OUT=aAbb3a abaonebaaaAAA bAtwo7aabthreeaa
Concerning the syntax of ...A[0..73].. I know that this expression
is interpretated as you mentioned. This was only a "pseudo" syntax
to show a "similar" wish-to-have syntax.
I am searching a correct perl replacement.
Thank you
Marcus
In article <slrn7sute6.fh1.sholden@pgrad.cs.usyd.edu.au>,
sholden@cs.usyd.edu.au wrote:
> On Fri, 03 Sep 1999 06:55:13 GMT, marcza@my-deja.com
<marcza@my-deja.com> wrote:
> >Assume the following code:
> >
> >$A[3] = "one";
> >$A[7] = "two";
> >$A[73] = "three";
> >
> >$text = "aAbb3a abaA3baaaAAA bAA77aabA73aa\n";
> >$text =~ s/(A([0..73]{1,2}))/$A[$2]/g;
> ^^^^^^
> That does not do what you think it does. I suggest you read the
documentation
> that comes with perl and find out what it really does. 'perldoc
perlre' might
> be a good place to start...
>
> >
> >print "OUT=$text#$1#$2#$3#\n";
> >
> >In the example A3 and A7 is replaced as desired
> >but A73 is replaced with $A[7] instead of $A[73].
>
> No it isn't...
>
> Here's my output :
> OUT=aAbb3a abaonebaaaAAA bAaabthreeaa
> ^^^ ^^^^^
> $A[3] $A[73]
>
> --
> Sam
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 07 Sep 1999 05:26:59 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: I'm not as lazy as I could be...
Message-Id: <Dm1B3.320$u73.37507@news.itd.umich.edu>
I'd do this myself, but I'm not yet adept enough at X11 programming...
Can anyone tell me how to use one of the X11::* modules to grab the
contents of the current X selection?
I want to write a little script that reads the selection, then immediately
execs a browser, passing the selection contents as the first argument.
It's just gotten too darn tedious manually pasting a URL into the browser's
"Go To" area.
Thanks in advance!
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Tue, 07 Sep 1999 05:37:19 GMT
From: Kevin Colquitt <synced@austin.rr.com>
Subject: Re: mysql interview
Message-Id: <Pine.LNX.4.10.9909070046020.18946-100000@kalimoth.death.org>
You saved me 35 bucks :) ...
On 6 Sep 1999, Abigail wrote:
> George Reese (borg@imaginary.com) wrote on MMCXCVIII September MCMXCIII
> in <URL:news:eA%A3.376$96.26431@ptah.visi.com>:
> %%
> %% I really do not care if my opinions carry weight with you or
> %% Abigail. You both clearly lack any reasoning skills. I am just trying
> %% to point out your faulty reasoning for people who might actually find
> %% my book useful for learning MySQL or mSQL except for your irrational
> %% criticisms.
>
>
> I'm just trying to prevent people from spending money to buy your books.
>
>
>
> Abigail
> --
> perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
> qq{Just Another Perl Hacker\n}}}}}}}}}' |\
> perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -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: Tue, 07 Sep 1999 06:18:06 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: mysql interview
Message-Id: <y62B3.6054$0M6.149385@news1.rdc2.on.home.com>
In article <eA%A3.376$96.26431@ptah.visi.com>,
George Reese <borg@imaginary.com> wrote:
[snip]
! I really do not care if my opinions carry weight with you or
! Abigail. You both clearly lack any reasoning skills. I am just trying
! to point out your faulty reasoning for people who might actually find
! my book useful for learning MySQL or mSQL except for your irrational
! criticisms.
Speaking of reasoning skills, who wants to pay good money for
a book buy an author who uses the following logic:
! in Message-ID: <wv0O1.1521$Ge.4809664@ptah.visi.com>
!
! George Reese wrote:
! ! I have provided premises which you can debate or not. You have not
! ! chosen to debate those premises. What exactly do you want?
! !
! ! If I say:
! !
! ! All Americans speak French.
! ! I am American.
! ! Therefore I speak French.
! !
! ! As this argument follows from the premises, I have provided an
! ! argument with support. You can either choose to debate my premises or
! ! concede that I speak French.
But then you also add this:
! You are bordering on ridiculous if you think you need to support your
! premises. Such an argument is an infinite regression.
So, your argument is "supported" with whatever premises you put
forward, and we can choose to debate your premises --- But, you won't
need to support those premises (as in a "debate") because that would
be an infinite regress. You never did grasp the difference between an
internally consistent argument and a supported argument, perhaps this
will illustrate the point:
A book (not to mention software) written by an author who doesn't
understand basic logic is a waste of money
George Reese does not understand basic logic
Therefore, one should not waste one's money on a book (not to
mention software) authored by George Reese.
By your own reasoning, I have provided a "supported" argument why
people should not waste their money buying your book. Now, you can
go ahead and enter the infinite regress of debating my premises, but
you may find that many people already notice the support (by example)
I have provided above for my second premise (I leave the first
premise entirely up to the buyer's discretion to accept or reject).
andrew
--
Doing linear scans over an associative array is like
trying to club someone to death with a loaded Uzi.
-- Larry Wall
------------------------------
Date: 07 Sep 1999 17:09:39 +1200
From: Andrew Gray <agray@infoscience.otago.ac.nz>
Subject: Re: Pattern substitution
Message-Id: <ud7vvwbn0.fsf@infoscience.otago.ac.nz>
"Benjamin Bérubé" <berube@odyssee.net> writes:
> Suppose I have the following string :
> $text = " I am writing (this) or again (that) ";
> Now, I want to replace "(this)" by new = "new text"
> If I do :
> $text =~ s/(.*)/$new/;
> it gives : " I am writing new text " instead of " I am writing new text or
> again (that) "
Actually, it would give "new text" since you failed to escape the
parentheses.
Regexs in Perl are greedy. That is to say, they match as much as
possible. So your pattern (once the parentheses are escaped) is
matching a (, followed by as many characters as possible, followed by
a ). If you want to use non-greedy matching, put a ? after the
quantifier. See "perldoc perlre" for more details.
#!/usr/bin/perl -w
use strict;
my $text = "I am writing (this) or again (that)";
print $text."\n";
my $new = "new text";
$text =~ s/\(.*?\)/$new/;
print $text."\n";
produces
I am writing (this) or again (that)
I am writing new text or again (that)
------------------------------
Date: Mon, 6 Sep 1999 22:13:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Pattern substitution
Message-Id: <MPG.123e3ec71a784c85989f1e@nntp.hpl.hp.com>
In article <2a0B3.4324$FW3.4686@news21.bellglobal.com> on Tue, 07 Sep
1999 04:05:18 GMT, Benjamin Bérubé <berube@odyssee.net> says...
> Suppose I have the following string :
>
> $text = " I am writing (this) or again (that) ";
>
> Now, I want to replace "(this)" by new = "new text"
>
> If I do :
> $text =~ s/(.*)/$new/;
> it gives : " I am writing new text " instead of " I am writing new text or
> again (that) "
>
> What is wrong ? thanks in advance.
The first thing and the worst thing that is wrong is your statement
about what happens. It gives 'new text', no more and no less. You
claim that it gives " I am writing new text " because you think
parentheses are literal characters, and you are making conjectures about
their behavior instead of testing the code before posting it. That is a
very irresponsible way of getting useful help.
So let's assume that you meant to write and test a meaningful regex,
escaping the parentheses.
s/\(.*\)/$new/
Now it gives what you said it does.
To learn how to fix it, I suggest you read perlre, looking in particular
for the discussion of 'greedy matchng'.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 07 Sep 1999 05:07:49 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: perl mail filter?
Message-Id: <F41B3.317$u73.37595@news.itd.umich.edu>
Keywords: Hexapodia as the key insight
In article <7qujo3$q43$1@news1.Radix.Net>, revjack <revjack@radix.net> wrote:
>Just curious, has anyone here ever written their own procmail-style
>e-mail filter using perl? I keep getting these suicidal impulses to
>do this every six months or so, and I was wondering if anyone had any
>success/failure stories or advice.
I've toyed with this idea too, but always come to the conclusion that
procmail is already ideally suited for its task, so it'd be a waste of
effort to duplicate it in Perl.
I do, however, use a Perl script as an input filter to procmail in order to
process mail that's forwarded to me from our GroupWoes mail server (which
moves the original headers into the message body):
----------------------------------------------------------------------
$/ = ""; # paragraph mode
$PROCMAIL = "/usr/local/bin/procmail";
-x $PROCMAIL && open(STDOUT, "| $PROCMAIL -Yf-") || exit 75;
$hdr1 = <STDIN>; # first header
$hdr2 = <STDIN>; # header if this is a forwarded message, else part of body
$hdr1 =~ /^X-Mailer: Novell GroupWise/m &&
$hdr1 =~ /^Sender: [Pp]ostmaster/m &&
$hdr2 =~ /^(?:(?:[ \t]|[-A-Za-z0-9]+:).*\n)+\n+$/ &&
$hdr2 =~ tr/\n// >= 5 &&
$hdr1 =~ s/\n.*/\n/s; # strip all but first line from first header
print $hdr1, $hdr2;
$/ = "\n"; # back to line mode
print while <STDIN>;
----------------------------------------------------------------------
Kinda nifty, now that I think about it, that every piece of mail I've
received for the last several months has passed through Perl.
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Tue, 7 Sep 1999 14:57:38 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Problem with <!--#exec cgi=/scripts/script.pl%22--> in IIS4
Message-Id: <dn1B3.14$eK5.1629@vic.nntp.telstra.net>
Abigail <abigail@delanet.com> wrote in message
news:slrn7t95tp.lt8.abigail@alexandra.delanet.com...
> Lisa (lisa_mcnally@mail.crc.com) wrote on MMCXCI September MCMXCIII in
> <URL:news:i3Qy3.193$Zd.115288@WReNphoon3>:
> <> Hi -
>
> Soooo... what is your Perl question? Or are you claiming the "nothing"
> happens only happens with a Perl program, but everything happens with
> an equivalent Eiffel program?
>
>
>
> Abigail
> --
Of course an actually useful response is:
"IIS does not support SSI"
(actually I find that statement mildly amusing in it's own right!)
Wyzelli
------------------------------
Date: 7 Sep 1999 02:30:43 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Problem with <!--#exec cgi=/scripts/script.pl%22--> in IIS4
Message-Id: <slrn7t9fuc.lt8.abigail@alexandra.delanet.com>
Wyzelli (wyzelli@yahoo.com) wrote on MMCXCVIII September MCMXCIII in
<URL:news:dn1B3.14$eK5.1629@vic.nntp.telstra.net>:
[] Abigail <abigail@delanet.com> wrote in message
[] news:slrn7t95tp.lt8.abigail@alexandra.delanet.com...
[] >
[] > Soooo... what is your Perl question? Or are you claiming the "nothing"
[] > happens only happens with a Perl program, but everything happens with
[] > an equivalent Eiffel program?
[]
[] Of course an actually useful response is:
[]
[] "IIS does not support SSI"
Not in a Usenet group about Perl.
Abigail
--
BBQed penguins do not fly to Bermuda on Wednesdays.
-----------== 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: 7 Sep 1999 07:06:12 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: reading complex data from a file
Message-Id: <7r2dh4$9mj$1@news.fsu.edu>
How can I read complex data from a file?
0 0 0.110580708557129+1.3236201534729i
chop($line); ($x,$y,$cnum) = split(/\s+/,$line);
$ppm[$x][$y]{real} = $cnum->Re();
$ppm[$x][$y]{imag} = $cnum->Im();
This doesn't work.
A related question, how can you output complex data
in the various formats?
Thanks in advance.
------------------------------
Date: Mon, 06 Sep 1999 23:17:18 -0600
From: Jim Cromie <jimcr@bwn.net>
Subject: Re: Select Multiple Form Field via Perl into Oracle error
Message-Id: <37D49FDE.E2B1CECC@bwn.net>
> In article <ej%w3.1$2B2.769@news.enterprise.net>,
> Simmo <simsi@hotmail.com.nospam> wrote:
> >select more than one i get:
> >
> >DBD::Oracle::db prepare failed: ORA-01756: quoted string not properly
> >terminated (DBD ERROR: OCIStmtPrepare) at news.pl line 855.
> >$SQL1 = "INSERT into news (type) VALUES ('$categories_selected')";
I think your problem is due to contents of $categories_selected, print it and
see.
if it contains something like
"column1, column2"
then SQL quoting rules are violated; each value needs to be treated individually
(and quoted or not depending upon column type - string or integer, etc)
It might work, if all columns are integers, iff you remove the single quotes
around $categories
Im puzzled though why its not @categories_selected, which at least
could hold more than one item.
Also,
{ local $" = ',';
$SQL = "insert .... VALUES( @categories ); ";
}
would separate elements by commas, as per SQL.
Lastly,
you could test numeric vs string value of each element, and quote the value
accordingly. This might not be robust enough (see faq on numeric vs string,
I have no idea which faq tho)
------------------------------
Date: 06 Sep 1999 21:39:14 +0200
From: Jean-Louis Leroy <jll@enterprise.newedgeconcept>
Subject: Re: Subscribing to p5p
Message-Id: <m3n1uzg78d.fsf@enterprise.newedgeconcept>
brian@pm.org (brian d foy) writes:
> btw, you can get to the old Perl Institute site by visiting
> tpi.perl.org.
Thanks. Telling 'subscribe perl5-porters' to majordomo@perl.org didn't
work, I assume this information is outdated...
JL
------------------------------
Date: Tue, 07 Sep 1999 02:13:34 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Subscribing to p5p
Message-Id: <brian-ya02408000R0709990213340001@news.panix.com>
In article <m3n1uzg78d.fsf@enterprise.newedgeconcept>, Jean-Louis Leroy <jll@enterprise.newedgeconcept> posted:
> brian@pm.org (brian d foy) writes:
>
> > btw, you can get to the old Perl Institute site by visiting
> > tpi.perl.org.
>
> Thanks. Telling 'subscribe perl5-porters' to majordomo@perl.org didn't
> work, I assume this information is outdated...
there is something new, and when people return from the holiday i'll get
that information to you as quickly as possible.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Tue, 7 Sep 1999 15:19:36 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: suggestion to revise grep (another Q: reference comparison)
Message-Id: <7r2e6e$3hs@netnews.hinet.net>
Dear all,
It happened on my careless bug.
@friends=('Johnson','Mary','Tommy');
$person='Johnson';
if(grep($person,@friends)) { print "$person is my friend" }
Hey, I got strange friends on those input values
$person='John'; $person='Tom'; and even $person='son';
Finally I know I should write
grep(/^$person$/,@friends);
or
grep { $person eq $_ } @friends;
But I think it is worthy to revise the grep function
since "find an element in an array" is quite basic.
For example, elements can be objects:
@objects=($johnson,$mary,$tommy);
$reference=$johnson;
if(grep($reference,@objects)) { # simpler and clearer
print $reference->{name}," is my friend";
}
(Here I got another question:
How can we compare references?
It's not documented in perlref.)
Hey, the above code works fine!!!
I guess it works because I luckily grep on the string
"HASH(0xcb3d80)"
among a list of strings
("HASH(0xcb3d80)","HASH(0xcb3d12)","HASH(0xcb3d34)");
(Does it imply that
in Perl, we use 'eq' for reference comparison?)
Anyway, just like we have 2 kinds of split:
split on regular expression and split on string,
my suggestion is to revise grep
so that we have 3 kinds of grep:
grep on regular expression: grep /expression/,@array
grep on computation: grep { block } @array
grep to find an element: grep $scalar,@array
It would be more clear and
produce less invisible bugs (like I did).
What do you think about it?
Thank you for your advices.
John Lin
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 727
*************************************