[23879] in Perl-Users-Digest
Perl-Users Digest, Issue: 6082 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 5 03:05:37 2004
Date: Thu, 5 Feb 2004 00:05:07 -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 Thu, 5 Feb 2004 Volume: 10 Number: 6082
Today's topics:
Re: Clarifications <tadmc@augustmail.com>
Re: Clarifications <tadmc@augustmail.com>
Re: Clarifications <uri@stemsystems.com>
Re: Clarifications <uri@stemsystems.com>
Re: Clarifications <matthew.garrish@sympatico.ca>
Re: Clarifications <matthew.garrish@sympatico.ca>
Re: Clarifications <uri@stemsystems.com>
Re: Clarifications <edgrsprj@ix.netcom.com>
Re: Clarifications <edgrsprj@ix.netcom.com>
Re: Clarifications <edgrsprj@ix.netcom.com>
Re: Clarifications <uri@stemsystems.com>
Re: Clarifications <Joe.Smith@inwap.com>
Re: Clarifications <uri@stemsystems.com>
Re: Clarifications <tassilo.parseval@rwth-aachen.de>
Re: Copy Constructor Craziness <drumspoorly@reachone.net>
Re: Counting words <jurgenex@hotmail.com>
Re: Counting words <tadmc@augustmail.com>
Re: Counting words <uri@stemsystems.com>
Re: Difficulty cleaning oddly encoded whitespace (from (Himanshu Garg)
Re: how to find the last "new line" in string <perl@my-header.org>
Re: Looking for a FAQ article on autoposting in PERL <tadmc@augustmail.com>
Re: newbie help <tadmc@augustmail.com>
Re: newbie help <tadmc@augustmail.com>
Re: Perl data types <jurgenex@hotmail.com>
Re: Perl data types <tassilo.parseval@rwth-aachen.de>
Re: Simple syntax question <tadmc@augustmail.com>
Re: Soap-Lite XML parameter error, doc must have top le <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 4 Feb 2004 16:57:58 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Clarifications
Message-Id: <slrnc22u7m.20g.tadmc@magna.augustmail.com>
Scott Bryce <sbryce@scottbryce.com> wrote:
> edgrsprj wrote:
>
>> I have been developing computer programs in a number of languages for quite
>> a few years.
You've managed to miss a lot along the way then.
> Has anyone suggested the llama book?
The Llama book is for programmers, edgrsprj is not a programmer,
despite any claims to the contrary.
A Real Programmer would not blame the language for OS features
as edgrsprj does:
print "Text message\n";
print 'Text message',"\n";
Both of those commands produce the same result. They cause
the string "Text message" to immediately print. If the \n is
not present the Perl program will wait until it is done with
all of its calculations etc. before it prints anything.
If you make that same output in Python or Ruby you'd get the
same behavior (due to output buffering), so it cannot be
the languages "fault".
It is not the "Perl program" that waits, it is the "terminal"
(aka the OS) that waits.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 4 Feb 2004 16:43:43 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Clarifications
Message-Id: <slrnc22tcv.20g.tadmc@magna.augustmail.com>
edgrsprj <edgrsprj@ix.netcom.com> wrote:
> Do you know if Ruby will generate code which can be used for CGI programs at
> Web sites?
Why ask Perl people about what Ruby can do?
Don't you think you might get a better answer from Ruby people?
Please don't ask Ruby questions in the Perl newsgroup,
ask Ruby questions in the Ruby newsgroup:
comp.lang.ruby
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 05 Feb 2004 02:48:07 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Clarifications
Message-Id: <x7ptcu2qe0.fsf@mail.sysarch.com>
>>>>> "e" == edgrsprj <edgrsprj@ix.netcom.com> writes:
e> Now I see what you mean. I will have to check on how my word
e> processor is generating those quotes. There is probably some way
e> to ensure that they all look the same.
simple. don't use a word processor to edit code. use a text
editor. people who use word to edit code are stupid twice over.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 05 Feb 2004 02:51:29 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Clarifications
Message-Id: <x7n07y2q8e.fsf@mail.sysarch.com>
>>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:
TM> It is not the "Perl program" that waits, it is the "terminal"
TM> (aka the OS) that waits.
actually it is the stdio library that is waiting. it doesn't flush until
it sees a \n when you are in normal line buffered mode. and in modern
perl's that is done (emulated) in PerlIO so it is in perl. now
regardless of who deals with the line buffering, our earthquaking troll
is clueless and won't learn or listen. but he is much more fun than the
japanese monster who must not be named. long break this time and i hope
it continues.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 4 Feb 2004 21:58:30 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Clarifications
Message-Id: <njiUb.8786$bp1.499158@news20.bellglobal.com>
"edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
news:vz9Ub.10340$GO6.10298@newsread3.news.atl.earthlink.net...
>
> I have been developing computer programs in a number of languages for
quite
> a few years.
There's a frightening thought. Do you stick to one language at a time, or do
you just mash them all together in your code and hope for the best?
> And it usually does not take me too long to shift from one to
> another for simple applications.
Most people have the ability to not understand a language in very little
time. How does that make you special?
> But I found it to be difficult to get
> started with Perl and still have quite a bit to learn.
print 'Who is the bigger fool: the fool or the fool who follows him?';
You have a Perl program in that line, Obi Wan. If you think it's hard to get
started in Perl, you definitely have no programming experience.
> And my feeling is
> that if I could not learn it right away with all of my programming
> experience then many other people would probably have trouble.
And so you're going to guide them to the light by proving how little you
were able to understand? Are you oblivious to the illogic that permeates
your writing?
> I am not
> saying that it is not a good language but only that it does not appear to
be
> one where you can install it and then never having seen it before just sit
> down and immediately start writing simple programs which will open and
close
> files etc.
>
And what would be a simpler language, in your worldly experience?
Never mind, on second thought. How about instead you just do everyone here a
favour and STFU already!
Matt
------------------------------
Date: Wed, 4 Feb 2004 22:36:37 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Clarifications
Message-Id: <6TiUb.5063$ZN1.453548@news20.bellglobal.com>
"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7ptcu2qe0.fsf@mail.sysarch.com...
> >>>>> "e" == edgrsprj <edgrsprj@ix.netcom.com> writes:
>
> e> Now I see what you mean. I will have to check on how my word
> e> processor is generating those quotes. There is probably some way
> e> to ensure that they all look the same.
>
> simple. don't use a word processor to edit code. use a text
> editor. people who use word to edit code are stupid twice over.
>
If you've got an easier way to get a binary from your code than by using
Word I'd like to hear it. Sometimes I wonder what you're smoking...
Matt
------------------------------
Date: Thu, 05 Feb 2004 05:01:35 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Clarifications
Message-Id: <x7u12615n5.fsf@mail.sysarch.com>
>>>>> "MG" == Matt Garrish <matthew.garrish@sympatico.ca> writes:
MG> "Uri Guttman" <uri@stemsystems.com> wrote in message
MG> news:x7ptcu2qe0.fsf@mail.sysarch.com...
>> >>>>> "e" == edgrsprj <edgrsprj@ix.netcom.com> writes:
>>
e> Now I see what you mean. I will have to check on how my word
e> processor is generating those quotes. There is probably some way
e> to ensure that they all look the same.
>>
>> simple. don't use a word processor to edit code. use a text
>> editor. people who use word to edit code are stupid twice over.
>>
MG> If you've got an easier way to get a binary from your code than by
MG> using Word I'd like to hear it.
what in the world does that mean? we are talking about editing code
which is text.
>>>>> "MG" == Matt Garrish <matthew.garrish@sympatico.ca> writes:
MG> Sometimes I wonder what you're smoking...
wanna buy some?
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 05 Feb 2004 06:15:05 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Clarifications
Message-Id: <JblUb.11189$GO6.10374@newsread3.news.atl.earthlink.net>
"John W. Kennedy" <jwkenne@attglobal.net> wrote in message
news:gDfUb.11416$%93.3170759@news4.srv.hcvlny.cv.net...
>
> Ruby has, in its standard distribution, a CGI package that is similar,
> on the whole, to the PERL CGI package. If you are building your own
> server, either one will work.
>
Thanks for the information.
------------------------------
Date: Thu, 05 Feb 2004 06:21:23 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Clarifications
Message-Id: <DhlUb.11196$GO6.660@newsread3.news.atl.earthlink.net>
"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7ptcu2qe0.fsf@mail.sysarch.com...
> >>>>> "e" == edgrsprj <edgrsprj@ix.netcom.com> writes:
> simple. don't use a word processor to edit code. use a text
> editor. people who use word to edit code are stupid twice over.
The actual html pages are being created and edited with the Netscape Web
page Composer. As I said, I need to take a look at how the text are being
managed.
------------------------------
Date: Thu, 05 Feb 2004 06:24:29 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Clarifications
Message-Id: <xklUb.11202$GO6.3014@newsread3.news.atl.earthlink.net>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnc22u7m.20g.tadmc@magna.augustmail.com...
> Scott Bryce <sbryce@scottbryce.com> wrote:
> > edgrsprj wrote:
> A Real Programmer would not blame the language for OS features
> as edgrsprj does:
>
I am not blaming Perl for anything. My code examples simply say to people
who are not experts, if you do "this" then the result will be "that." It
can save people some guessing and experimenting time. Also I am having
discussions with someone else regarding how to do all of this in a more
accurate and acceptable way. If there is some success with that then my Web
page will probably disappear. It might anyway.
------------------------------
Date: Thu, 05 Feb 2004 06:39:45 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Clarifications
Message-Id: <x74qu6113j.fsf@mail.sysarch.com>
>>>>> "e" == edgrsprj <edgrsprj@ix.netcom.com> writes:
e> I am not blaming Perl for anything. My code examples simply say to
e> people who are not experts, if you do "this" then the result will
e> be "that." It can save people some guessing and experimenting
e> time. Also I am having discussions with someone else regarding how
huh? giving wrong information helps people from guessing? your comments
on how printing works is beyond clueless. they have nothing to do with
the reality of the underlying reasons. it is like saying stuff gets
printed or not based on the phase of the moon.
e> to do all of this in a more accurate and acceptable way. If there
e> is some success with that then my Web page will probably disappear.
random text will be more accurate than your stuff. try to get it. you
don't know perl so how can you possibly try to teach it?
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 05 Feb 2004 07:15:14 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Clarifications
Message-Id: <64mUb.228286$na.366514@attbi_s04>
edgrsprj wrote:
> "Uri Guttman" <uri@stemsystems.com> wrote in message
> news:x7ptcu2qe0.fsf@mail.sysarch.com...
>
>>>>>>>"e" == edgrsprj <edgrsprj@ix.netcom.com> writes:
>
>
>>simple. don't use a word processor to edit code. use a text
>>editor. people who use word to edit code are stupid twice over.
>
>
> The actual html pages are being created and edited with the Netscape Web
> page Composer. As I said, I need to take a look at how the text are being
> managed.
Real programmers use EDIT or vi or emacs or TECO. :-)
-Joe
------------------------------
Date: Thu, 05 Feb 2004 07:40:11 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Clarifications
Message-Id: <x7wu72ynxg.fsf@mail.sysarch.com>
>>>>> "JS" == Joe Smith <Joe.Smith@inwap.com> writes:
JS> edgrsprj wrote:
>> "Uri Guttman" <uri@stemsystems.com> wrote in message
>> news:x7ptcu2qe0.fsf@mail.sysarch.com...
>>
>>>>>>>> "e" == edgrsprj <edgrsprj@ix.netcom.com> writes:
>>
>>> simple. don't use a word processor to edit code. use a text
>>> editor. people who use word to edit code are stupid twice over.
>> The actual html pages are being created and edited with the Netscape
>> Web
>> page Composer. As I said, I need to take a look at how the text are being
>> managed.
JS> Real programmers use EDIT or vi or emacs or TECO. :-)
ever do teco on a la-50?
and teco was a major step up from punch cards!
no clay tablet jokes, please.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 5 Feb 2004 07:51:11 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Clarifications
Message-Id: <bvsslf$84e$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Ben Morrow:
> Michele Dondi <bik.mido@tiscalinet.it> wrote:
>> On Wed, 04 Feb 2004 01:00:15 GMT, "John W. Kennedy"
>> <jwkenne@attglobal.net> wrote:
>>
>> Well, in practice *I* (not you) have *only* "initials" and
>> "abbreviation". But indeed "sigla" is also used for monograms.
>>
>> To cut the story down, the point is that both officially and to common
>> people a "thing" like "USA", "CCCP" (i.e. "SSSR", btw!), etc. is a
>> sigla.
>
> So you wouldn't make the distinction between something like 'USA' and
> something like 'NATO'? Interesting.
Note that this distinction also exists in German (although it is mostly
used by linguists): We have "Initialwort" which would be USA or EU for
instance and we have "Akronyme" such as NATO or AIDS.
People tend to blur this distinction, though. And looking at online
dictionaries such as <http://dict.leo.org/?lang=de> they do the same
by claiming that "Initialwort" would be "acronym" in English.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Wed, 04 Feb 2004 19:36:51 -0800
From: Steve May <drumspoorly@reachone.net>
Subject: Re: Copy Constructor Craziness
Message-Id: <1023ea5fm0btfc4@corp.supernews.com>
Unknown Poster wrote:
> The behavior I'm seeing in Perl 5.6 contradicts what I understand
> about copy constructors - specifically, when they are autogenerated.
>
> # $f is a reference to an object
> my $g = $f;
so, assuming that $f is indeed a scalar reference $g now equals
something like:
SCALAR(0x80545ac)
Is this what you want/expect?
> print "\$g = $g, ";
> ++$g;
Hmmmm... doesn't look like it, at least it looks like you are
trying to increment a scalar....
> print "after ++, \$g = $g, \$f = $f\n"; # The value of $g changes,
> but the
> # value of $f does not!
>
#! /usr/bin/perl -w
use strict;
my $base = 4;
my $f = \$base;
my $g = $f;
print "g is $g and f is $f\n";
> g is SCALAR(0x80545ac) and f is SCALAR(0x80545ac)
$$g++;
print "g is $$g, and f is $$f\n";
> g is 5, and f is 5
s.
------------------------------
Date: Thu, 05 Feb 2004 03:16:45 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Counting words
Message-Id: <xAiUb.6492$CE5.1345@nwrddc03.gnilink.net>
Fran wrote:
> Can anybody please tell me how to count words? If a need to know if an
> input has n words, how do I do it?
Please define "word".
jue
------------------------------
Date: Wed, 4 Feb 2004 21:20:14 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Counting words
Message-Id: <slrnc23dje.2r1.tadmc@magna.augustmail.com>
Fran <fmeizoso@yahoo.es> wrote:
> Can anybody please tell me how to count words?
I don't know what your original problem is,
but I suggest to use a hash. --Rafael Garcia-Suarez
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 05 Feb 2004 05:02:41 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Counting words
Message-Id: <x7r7xa15la.fsf@mail.sysarch.com>
>>>>> "JE" == Jürgen Exner <jurgenex@hotmail.com> writes:
JE> Fran wrote:
>> Can anybody please tell me how to count words? If a need to know if an
>> input has n words, how do I do it?
JE> Please define "word".
please define 'please'
please define 'define'
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 4 Feb 2004 19:27:54 -0800
From: himanshu@gdit.iiit.net (Himanshu Garg)
Subject: Re: Difficulty cleaning oddly encoded whitespace (from MS HTML)
Message-Id: <a46e54c7.0402041927.2940a200@posting.google.com>
throop@cs.utexas.edu (David R. Throop) wrote:
> I'm perplexed. I'm writing a PERL script that reads a single large
> many-sectioned HTML document, breaks it into smaller files and
> extracts some information for another text-manipulation tool to
read.
> The first HTML file comes from saving a 150+ page MS-Word file as
HTML.
>
> I'm having fits with some nonstandard whitespace in the HMTL file.
It
> appears like a long whitespace and acts as a single character, but
it
> doesn't patternmatch a \s. When I view it in Emacs, it appears as
> %/1\200\216iso8859-15^B\201 \201 \201
I also had some strange behaviour when handling non English text. Try
setting the locale to POSIX ( on GNU/LINUX do export LC_ALL=POSIX ).
In Perl 5.8.1 or later, you can parse a UTF-8 text and output it
correctly in UTF-8 without using binmode. The above is not necessary
then.
++imanshu.
------------------------------
Date: Wed, 04 Feb 2004 20:28:04 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: how to find the last "new line" in string
Message-Id: <0qh220928amljlpt914dssbpu344aedk5t@4ax.com>
>>Hi,
>>If a string contains a few lines, (separated by '\n'), how can I make
>>a regular expression to replace this '\n' by a space?
>
>s/\n$/ /;
>this is only for last newline
chomp and $_.= ' ' for $string;
I think this could be faster.
--
Matija
------------------------------
Date: Wed, 4 Feb 2004 17:06:05 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Looking for a FAQ article on autoposting in PERL
Message-Id: <slrnc22umt.20g.tadmc@magna.augustmail.com>
cob <cob@hotmail.com> wrote:
> I maintain a FAQ for the misc.immigration.misc newsgroup. I have been
> looking for a short perl snippet to automate FAQ announcements that would be
> posted to the misc.immigration.misc newsgroup.
>
> Also a perl snippet that could be run once a week to post an article showing
> where the FAQ is.
> Is it possible?
Yes. I have one that sends the Posting Guidelines to this newsgroup
twice each week.
> I appreciate any pointers in the right direction!
long URL wrapped:
http://groups.google.com/groups?
as_umsgid=slrn9q4sgv.kth.tadmc%40tadmc26.august.net
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 4 Feb 2004 18:30:17 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: newbie help
Message-Id: <slrnc233ko.20g.tadmc@magna.augustmail.com>
[ Please do not post upside-down followups ]
Ram <spam@spammer.com> wrote:
> This string does not match
Does not match *what* ?
> if <ordsts> and </ordsts> has child tags spread
> across multiple lines.
How are you getting the multiple lines into $_ ?
> "Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
> news:bvp3d5$ujeo2$1@ID-184292.news.uni-berlin.de...
>> Assuming the data is in $_:
>>
>> my ($lastmatch) = /.*(<ordsts>.*<\/ordsts>).*/s;
That _will_ match across multiple lines.
You are probably running afoul of this Frequently Asked Question:
I'm having trouble matching over more than one line. What's wrong?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 4 Feb 2004 17:38:36 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: newbie help
Message-Id: <slrnc230js.20g.tadmc@magna.augustmail.com>
Ram <spam@spammer.com> wrote:
> Subject: newbie help
Please put the subject of your article in the Subject of your article.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 05 Feb 2004 04:43:03 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl data types
Message-Id: <rRjUb.5386$EH5.141@nwrddc01.gnilink.net>
Eric Schwartz wrote:
> What is a "product type"? I've not heard this terminology before.
It's a type whose elements are the mathematical product (sometimes called
cross product) of two sets.
For example, the cross product of string and number could be used to create
data elements, which contain a name and the associated income.
A familar product type would be e.g. the "RECORD" type in Pascal or Modula.
>> secondly, does this make a hash a product type, because the keys are
>> referenced by scalars,
Corrrection: the keys are are actual scalars
>> and these point to variables, which i guess
>> could be anything but allows a simple structure.
Well, I wouldn't call it "point to", but essentially you are right.
And yes, hashes could be considered to be a form of a product type.
>> thirdly, does perl support sum types
>
> What is a 'sum type'?
A sum type is the mathematical sum of its constituents, e.g. the enumeration
of elements in a Pascal SET type.
>> as far as I can tell, since perl is not a typed language as such it
>> is imposible to tell the differnce between the types,
You are mistaken, Perl is a strictly typed language. However, the types are
not what you would normally consider types. The Perl data types are scalar,
array, and hash. You just need to get used to that notion of type.
jue
------------------------------
Date: 5 Feb 2004 07:44:00 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Perl data types
Message-Id: <bvss80$7oj$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Eric Schwartz:
> "David Holmes" <no@spam.uk> writes:
>> As for sum types, they are subtly different. Values of a sum type are
>> tagged. This can take several forms but again in the example of a java.
>> Incase you cant tell this is the language I use most. If you have a base
>> class that extends a superclass1 and a superclass2. You can initialise a
>> variable as the base class, and then say:
>>
>> if (instanceOf(superclass1)) { do something }
>> else if (instanceOf(superclass2)) { do something else }
>
> But that's crappy OO programming. You should do
>
> object.method()
>
> instead, and let inheritance take care of what gets done, no?
No, not in Java. Due to broken-by-design method dispatch, you will
constantly be checking the type and then do a typecast. If you have a
class "Foo" with a method "bar" and you stuff 10 Foo objects into
Object array[10];
you can't just say 'array[0].bar'. Instead you have to write
((Foo)array[0]).bar();
This gets worse if 'array' contains Foo and Bar objects and both have a
"bar" method. Then this becomes:
if (array[0] instanceof Foo) {
((Foo)array[0]).bar();
} else {
((Bar)array[0]).bar();
}
Thus, it is often required in Java to do the type checking by hand.
Therefore I never quite understood how SUN can claim that Java has
polymorphism at all.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Wed, 4 Feb 2004 17:35:45 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Simple syntax question
Message-Id: <slrnc230eg.20g.tadmc@magna.augustmail.com>
Trimbitas Sorin <lacroix-iv@go.ro> wrote:
> What does the following line mean:
> 1: %checkType; ?? I know that @test="" is an array and $test="" is a
I don't know what the "1:" means.
I don't know what the "??" or the part of the line that follows it means.
%checkType;
Is the name of a hash data type, but that statement does not "do"
anything, it is a useless statement.
perldoc perldata
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 4 Feb 2004 21:14:37 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Soap-Lite XML parameter error, doc must have top level element
Message-Id: <slrnc23d8t.2r1.tadmc@magna.augustmail.com>
doug <doug_joel@bctel.ca> wrote:
> my $prod = "<?xml version = \"1.0\" encoding=\"UTF-8\"
> standalone=\"yes\"?>" .
If you used single quotes for the string, you wouldn't need
all of those backslashes.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 6082
***************************************