[25681] in Perl-Users-Digest
Perl-Users Digest, Issue: 7922 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 29 13:32:30 2005
Date: Tue, 29 Mar 2005 10:32:24 -0800 (PST)
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, 29 Mar 2005 Volume: 10 Number: 7922
Today's topics:
Using a for() statement to create a variable?? dayton@gecko.org
Re: Using a for() statement to create a variable?? <jurgenex@hotmail.com>
Re: Using a for() statement to create a variable?? <robic0@yahoo.com>
Re: Using a for() statement to create a variable?? <1usa@llenroc.ude.invalid>
Re: Using a for() statement to create a variable?? <robic0@yahoo.com>
Re: Using a for() statement to create a variable?? <jurgenex@hotmail.com>
Re: Using a for() statement to create a variable?? <robic0@yahoo.com>
Re: Using a for() statement to create a variable?? <jurgenex@hotmail.com>
Re: Using a for() statement to create a variable?? <tadmc@augustmail.com>
Re: Using a for() statement to create a variable?? <robic0@yahoo.com>
Re: Using a for() statement to create a variable?? <1usa@llenroc.ude.invalid>
Re: Using a for() statement to create a variable?? <jurgenex@hotmail.com>
Re: Using a for() statement to create a variable?? <joe@inwap.com>
Re: Using a for() statement to create a variable?? <nobull@mail.com>
Re: Using a for() statement to create a variable?? <nobull@mail.com>
Re: Using a for() statement to create a variable?? <tadmc@augustmail.com>
Re: Using a for() statement to create a variable?? <jwkenne@attglobal.net>
Re: Using a for() statement to create a variable?? robic0@yahoo.com
validate xml with xsd in perl script (JanVDV)
Re: validate xml with xsd in perl script <nobull@mail.com>
Re: validate xml with xsd in perl script <robic0@yahoo.com>
What does "while~<>" mean? <jkrugman345@yahbitoo.com>
Re: What does "while~<>" mean? <nobull@mail.com>
Re: What does "while~<>" mean? <see.sig@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Mar 2005 12:04:44 -0800
From: dayton@gecko.org
Subject: Using a for() statement to create a variable??
Message-Id: <1111867484.178618.229270@o13g2000cwo.googlegroups.com>
I have a form that is dynamiclly generated from a database. Using the
CGI module, I'm trying to parse the parameters returned, but since the
number of paramaters changes I can't get the variables assigned...
What I'm trying:
--------------
$count='1';
while (my(@data)=$table_data4->fetchrow_array) {
print qq|
<tr><td><input name=rs$count type=text
maxlength=7 size=7 value=$data[0]><td>$data[1]
|;
$count++;
}
--------------------
which correctly populates the table but then when I try to parse the
parms..
(like : if (param()){ $buh = param('buh') || '';}
I run into my problem. I've tried:
----------------------
for ($i=1;$i<=$number;$i++)
$R$i="rs$i";
}
----------------------
and the error I get is:
Scalar found where operator expected at ./test line 5, near "$RS$i"
(Missing operator before $i?)
syntax error at ./test line 5, near "$RS$i"
Execution of ./test aborted due to compilation errors.
How can I auto-generate the variables based on the # of params created
by the form?
------------------------------
Date: Sat, 26 Mar 2005 20:09:03 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <zjj1e.25454$b_6.20346@trnddc01>
dayton@gecko.org wrote:
> I have a form that is dynamiclly generated from a database. Using the
> CGI module, I'm trying to parse the parameters returned, but since the
> number of paramaters changes I can't get the variables assigned...
[...]
> for ($i=1;$i<=$number;$i++)
> $R$i="rs$i";
[...]
> How can I auto-generate the variables based on the # of params created
> by the form?
You don't. Symbolic references are evil, please see the FAQ and google. This
has been discussed to death many, many times over.
Instead us a more suitable data structure like a hash. Again, the FAQ
explains how ("How can I use a variable as a variable name?").
jue
------------------------------
Date: 26 Mar 2005 13:06:09 -0800
From: "robic0@yahoo.com" <robic0@yahoo.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <1111871169.129413.226980@f14g2000cwb.googlegroups.com>
Dynamically generate the code block, then use "eval" on it?
------------------------------
Date: Sat, 26 Mar 2005 22:18:15 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <Xns9625B00788F07asu1cornelledu@127.0.0.1>
"robic0@yahoo.com" <robic0@yahoo.com> wrote in
news:1111871169.129413.226980@f14g2000cwb.googlegroups.com:
> Dynamically generate the code block, then use "eval" on it?
To do what?
Sinan
------------------------------
Date: 26 Mar 2005 14:23:41 -0800
From: "robic0@yahoo.com" <robic0@yahoo.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <1111875821.874410.179780@f14g2000cwb.googlegroups.com>
"To do what?"
Weren't you the guy insulting me on another post....
------------------------------
Date: Sat, 26 Mar 2005 22:47:56 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <wEl1e.12000$uw6.8821@trnddc06>
[Full-quote]
robic0@yahoo.com wrote:
> "To do what?"
>
> Weren't you the guy insulting me on another post....
Who is "you"? Whom are you talking to?
Usenet is a 1-to-many communications form. Do you mean every single reader
of this newsgroup?
jue
------------------------------
Date: 26 Mar 2005 15:01:49 -0800
From: "robic0@yahoo.com" <robic0@yahoo.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <1111878109.625254.4890@o13g2000cwo.googlegroups.com>
""Who is "you"? Whom are you talking to?""
JH #2 - Please speak english in clear, readable and understandable
expressions.
What are "you" talking about?
------------------------------
Date: Sat, 26 Mar 2005 23:26:18 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <ucm1e.52990$hA3.17179@trnddc09>
robic0@yahoo.com wrote:
> ""Who is "you"? Whom are you talking to?""
I suppose this is a quote from an article I posted. It is common courtesy to
mark quoted text as such and to provide an attribution.
> JH #2 - Please speak english in clear, readable and understandable
> expressions.
> What are "you" talking about?
I strongly suggest that you read up on basic Nettiquette ASAP. You are on
the brink of being granted membership in many killfiles.
jue
------------------------------
Date: Sat, 26 Mar 2005 17:45:46 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <slrnd4bt1a.1qe.tadmc@magna.augustmail.com>
robic0@yahoo.com <robic0@yahoo.com> wrote:
> JH #2 - Please speak english in clear, readable and understandable
> expressions.
We will do that when you do that.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 26 Mar 2005 16:04:11 -0800
From: "robic0@yahoo.com" <robic0@yahoo.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <1111881850.965998.302940@f14g2000cwb.googlegroups.com>
"I suppose this is a quote from an article I posted. It is common
courtesy to
mark quoted text as such and to provide an attribution.
> JH #2 - Please speak english in clear, readable and understandable
> expressions.
> What are "you" talking about?
I strongly suggest that you read up on basic Nettiquette ASAP. You are
on
the brink of being granted membership in many killfiles.
"
I suggest you not mention "kill" as an attribute within your reply.
Should you feel the need
to kill someone, I suggest you consult proffessional help immediatly.
In America, we do not
take kindly to threats from individuals from foreign countries. Your
time may well be better
spent mastering english and gaining insite on American culture.
------------------------------
Date: Sun, 27 Mar 2005 00:33:03 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <Xns9625C6E312866asu1cornelledu@127.0.0.1>
"robic0@yahoo.com" <robic0@yahoo.com> wrote in
news:1111881850.965998.302940@f14g2000cwb.googlegroups.com:
> "I suppose this is a quote from an article I posted. It is common
> courtesy to mark quoted text as such and to provide an attribution.
And you have failed again to show common courtesy.
>> JH #2 - Please speak english in clear, readable and understandable
>> expressions.
>> What are "you" talking about?
>
> I strongly suggest that you read up on basic Nettiquette ASAP. You are
> on the brink of being granted membership in many killfiles. "
Ditto.
> I suggest you not mention "kill" as an attribute within your reply.
Your ignorance is amusing.
http://www.google.com/search?q=define%3A+killfile
> Should you feel the need to kill someone,
No one said anything about killing anyone.
> I suggest you consult proffessional help immediatly.
Spell check: 'professional' and 'immediately'
> In America, we do not take kindly to threats from individuals from
> foreign countries.
Just FYI: UseNet is not America.
> Your time may well be better spent mastering english and gaining
Spell check: 'English'.
> insite on American culture.
Spell check: 'insight'.
Grammer check: 'insight into American culture'.
I know, I know, I am feeding the troll.
I am going to shut up now.
Sinan.
------------------------------
Date: Sun, 27 Mar 2005 00:56:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <nxn1e.30456$oa6.4908@trnddc07>
robic0@yahoo.com wrote:
> "I suppose this is a quote from an article I posted. It is common
> courtesy to
> mark quoted text as such and to provide an attribution.
Would you please start providing proper credits when quoting text that you
didn't write? Or do you want to be accused of plagiarism?
>> JH #2 - Please speak english in clear, readable and understandable
>> expressions.
>> What are "you" talking about?
>
> I strongly suggest that you read up on basic Nettiquette ASAP. You are
> on
> the brink of being granted membership in many killfiles.
Again, I never granted you the right to copy my text and to claim it as your
own.
> I suggest you not mention "kill" as an attribute within your reply.
> Should you feel the need
> to kill someone, I suggest you consult proffessional help immediatly.
Your ignorance is surely broad. But really stunning is your resistance to
learning.
> In America, we do not
> take kindly to threats from individuals from foreign countries.
Yeah, true. It happens so easily that a certain person from Texas believes
you have weapons of mass destruction in your backyard....
BTW: Last time I checked America was a double continent. Which country
within (or outside of) this continent are you considering to be "foreign"?
> Your
> time may well be better
> spent mastering english and gaining insite on American culture.
Try "English" and "insight into".
Oh, and is there such a thing as _the_ American culture? I always found
Carribean, Canadian, and Argentinian culture to be quite different.
Proud to be an old European (although living in the USA).
jue
------------------------------
Date: Sat, 26 Mar 2005 17:35:46 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <TtKdnUiSa-pokNvfRVn-iQ@comcast.com>
robic0@yahoo.com wrote:
> Dynamically generate the code block, then use "eval" on it?
No! That is as bad, if not worse, than symbolic references.
The message you are following up to (which you neglected to
include any part of in your message) has the correct answer.
It is quite clear that you are inexperienced in the ways of
USENET. USENET is not the same as a web forum.
When you post a follow-up message here, you are expected to
include the name of the previous poster and a selected
portion of the previous message.
------------------------------
Date: Sun, 27 Mar 2005 09:34:38 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <d25uch$hsg$1@sun3.bham.ac.uk>
Jürgen Exner wrote:
> dayton@gecko.org wrote:
>
>>How can I auto-generate the variables based on the # of params created
>>by the form?
>
> You don't. Symbolic references are evil, please see the FAQ and google.
See also message <u9669c3o2w.fsf@wcl-l.bham.ac.uk>
http://groups.google.co.uk/groups?selm=u9669c3o2w.fsf%40wcl-l.bham.ac.uk
> This
> has been discussed to death many, many times over.
> Instead us a more suitable data structure like a hash.
In the OP's example an array is probably the more natural structure.
------------------------------
Date: Sun, 27 Mar 2005 09:54:58 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <d25vil$iei$1@sun3.bham.ac.uk>
robic0@yahoo.com in a typical display of rudeness gives no context when
he says:
[ Of using symrefs in a loop to create several variables with numeric
suffixes ]
> Dynamically generate the code block, then use "eval" on it?
It is, of course, a general rule that any inappropriate use of symrefs
can be made even worse by using eval instead of symrefs.
Symrefs and eval(STRING) are powerfull but dangerous tools. Use them
only when the beniefits outweigh the costs. Symrefs are the lesser of
the two (in both power and danger).
------------------------------
Date: Sun, 27 Mar 2005 08:01:52 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <slrnd4df6g.1ja.tadmc@magna.augustmail.com>
robic0@yahoo.com <robic0@yahoo.com> wrote:
> You are
> on
> the brink of being granted membership in many killfiles.
> I suggest you not mention "kill" as an attribute within your reply.
> Should you feel the need
> to kill someone,
Pardon me but your ignorance is showing yet again.
Nobody (apart from you) has said anything about killing anyone.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 27 Mar 2005 16:42:49 -0500
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: Using a for() statement to create a variable??
Message-Id: <zNF1e.2815$nA3.539@fe12.lga>
robic0@yahoo.com wrote:
> I suggest you not mention "kill" as an attribute within your reply.
> Should you feel the need
> to kill someone, I suggest you consult proffessional help immediatly.
> In America, we do not
> take kindly to threats from individuals from foreign countries. Your
> time may well be better
> spent mastering english and gaining insite on American culture.
Listen, you dirty little traitor. A lot of good Americans in my father's
generation gave their lives to put an end to vermin like you, and the
last thing we need is to have an infestation back home. So you can just
pack up your semiliterate, un-American shit and haul ass to North Korea,
where you'll be right at home.
--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
------------------------------
Date: Mon, 28 Mar 2005 23:48:07 -0800
From: robic0@yahoo.com
Subject: Re: Using a for() statement to create a variable??
Message-Id: <ae1i41142f0uej4p71cfcs6t6c0nrageth@4ax.com>
On Sun, 27 Mar 2005 16:42:49 -0500, "John W. Kennedy"
<jwkenne@attglobal.net> wrote:
>robic0@yahoo.com wrote:
>> I suggest you not mention "kill" as an attribute within your reply.
>> Should you feel the need
>> to kill someone, I suggest you consult proffessional help immediatly.
>> In America, we do not
>> take kindly to threats from individuals from foreign countries. Your
>> time may well be better
>> spent mastering english and gaining insite on American culture.
>
>Listen, you dirty little traitor. A lot of good Americans in my father's
>generation gave their lives to put an end to vermin like you, and the
>last thing we need is to have an infestation back home. So you can just
>pack up your semiliterate, un-American shit and haul ass to North Korea,
>where you'll be right at home.
No problem. I'm in Los Angeles, California name a time and place so
i can meet you and your fatther
------------------------------
Date: 25 Mar 2005 23:42:27 -0800
From: JanVdVogel@hotmail.com (JanVDV)
Subject: validate xml with xsd in perl script
Message-Id: <5e3d1dc7.0503252342.2dcfd97e@posting.google.com>
Hey,
I have an xml file, and I want to assign a xml schema to it.
The only way I can do this is through a perl script. I am not
able to open the xml file and type the schema reference to it,
so I really need to do it through the script.
Can someone help me?
TX.
------------------------------
Date: Sat, 26 Mar 2005 09:06:04 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: validate xml with xsd in perl script
Message-Id: <d238b0$mbf$1@sun3.bham.ac.uk>
JanVDV wrote:
> I have an xml file, and I want to assign a xml schema to it.
> The only way I can do this is through a perl script. I am not
> able to open the xml file and type the schema reference to it,
> so I really need to do it through the script.
XML::LibXML last time I researched it in detail did not do this but I
have heard since that libxml now does so I would hope XML::LibXML would
soon (but it's not documented).
There is XML::Validator::Schema but that admits to being incomplete.
If that doesn't work there's an XSL script somewhere that transforms an
XSD into another XSL script that validates that XML conforms to the XSD.
(So you could use XML::LibXSLT).
------------------------------
Date: 26 Mar 2005 13:01:38 -0800
From: "robic0@yahoo.com" <robic0@yahoo.com>
Subject: Re: validate xml with xsd in perl script
Message-Id: <1111870898.391427.217270@g14g2000cwa.googlegroups.com>
Won't Xerces do that, or does it just do validation?
------------------------------
Date: Sat, 26 Mar 2005 07:47:41 +0000 (UTC)
From: J Krugman <jkrugman345@yahbitoo.com>
Subject: What does "while~<>" mean?
Message-Id: <d2342t$igv$1@reader1.panix.com>
I recently saw a Perl one-liner that ended with the construct
"while~<>". MO=Deparse was no help (it simply translated it to
"while ~<ARGV>"). I searched the Perl docs but found nothing.
What does the tilde before the <> operator mean?
Thanks!
jill
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.
------------------------------
Date: Sat, 26 Mar 2005 09:15:45 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: What does "while~<>" mean?
Message-Id: <d238t5$mfr$1@sun3.bham.ac.uk>
J Krugman wrote:
> I recently saw a Perl one-liner that ended with the construct
> "while~<>". MO=Deparse was no help (it simply translated it to
> "while ~<ARGV>"). I searched the Perl docs but found nothing.
> What does the tilde before the <> operator mean?
It is the binary not operator. It is one of the few Perl operatotions
that treats numbers differently from strings.
~1 is 4294967294 (assuming 64 bit integers)
~"\x01\x02" is "\xFE\xFD"
But this sounds like golfing to me (trying to write the smallest
possible code with no consideration given to clarity).
<> inside a while clause magically assignes $_ but ~<> supresses this.
So it simply waits for a line of input an thows it away.
foo while ~<>;
Is like
while (1) {
<>; # Pause
foo;
}
------------------------------
Date: Sat, 26 Mar 2005 19:39:16 GMT
From: Bob Walton <see.sig@rochester.rr.com>
Subject: Re: What does "while~<>" mean?
Message-Id: <ETi1e.113405$H05.66740@twister.nyroc.rr.com>
Brian McCauley wrote:
> J Krugman wrote:
...
> ~1 is 4294967294 (assuming 64 bit integers)
32---------------------------^^
...
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7922
***************************************