[29437] in Perl-Users-Digest
Perl-Users Digest, Issue: 681 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 25 21:12:41 2007
Date: Wed, 25 Jul 2007 18:09:10 -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 Wed, 25 Jul 2007 Volume: 11 Number: 681
Today's topics:
Re: @arts <tadmc@seesig.invalid>
Re: @arts <zaxfuuq@invalid.net>
Re: @arts <spamtrap@dot-app.org>
Re: I am giving up perl because of assholes on clpm -- <abigail@abigail.be>
Re: I am giving up perl because of assholes on clpm -- <jurgenex@hotmail.com>
Re: I am giving up perl because of assholes on clpm -- <jstroud@mbi.ucla.edu>
Re: match string by re using some pattern anno4000@radom.zrz.tu-berlin.de
Re: Math <nospam-abuse@ilyaz.org>
Re: Math <sigzero@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Jul 2007 23:29:48 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: @arts
Message-Id: <slrnfafn0d.qiu.tadmc@tadmc30.sbcglobal.net>
Michele Dondi <bik.mido@tiscalinet.it> wrote:
> Now, can I hope that you changed your identity once
> and that you won't do many more time in the future?
I'm afraid not.
It has changed its identity dozens of times over the past few years,
so we can expect that it will do so yet again.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Wed, 25 Jul 2007 17:36:14 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: @arts
Message-Id: <kYydnSyRzMMdcTrbnZ2dnUVZ_j6dnZ2d@comcast.com>
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:8akca3927fq220qfg789k6uofreqlh4spj@4ax.com...
> On Tue, 24 Jul 2007 11:46:10 GMT, "Jürgen Exner"
> <jurgenex@hotmail.com> wrote:
>
>>> What dimensions does @arts have?
>>
>>Oh please, arrays in Perl are _always_ linear.
>>If you want a more complex data structure you would use e.g. an array of
>>references to whatever
>
> On a second thought I suspect he used the term dimension in a sense
> akin to that of "unit of measure", as in "dimentional analysis". So
> chances are that he may be asking about the nature of the elements in
> the array.
>
>>> I would think that one dimension of @arts would have to be
>>> the difference between $first and $last.
>>
>>What? Why would the size of an array be a dimension of the array?
>
> Yes, in this sense my interpretation above does less sense: anyway I
> can't think of one that would do more.
I've been reading about the functions that I used in the original post. In
that syntax is
for (reverse $first..$last) { }
The only way I can see what happens here is if I replace it with my
pre-existing loop notions from C:
for (i = $last; i >= $first; -- i) {}
At least one problem with this substitution is that I can't figure out how
the code between the curly brackets knows it's being looped on without
reference to the dummy i . How does the intervening code in the former for
statement avail itself of the loop it is in?
--
Wade Ward
------------------------------
Date: Wed, 25 Jul 2007 21:08:07 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: @arts
Message-Id: <m2zm1k0y6g.fsf@dot-app.org>
"Wade Ward" <zaxfuuq@invalid.net> writes:
> I've been reading about the functions that I used in the original post.
Excellent, Smithers! (Sorry, I'm in a Simpsons mood this week...)
> that syntax is
> for (reverse $first..$last) { }
>
> The only way I can see what happens here is if I replace it with my
> pre-existing loop notions from C:
> for (i = $last; i >= $first; -- i) {}
>
> At least one problem with this substitution is that I can't figure out how
> the code between the curly brackets knows it's being looped on without
> reference to the dummy i . How does the intervening code in the former for
> statement avail itself of the loop it is in?
In the first form, you can declare a variable that will be an alias to each
element in the list being looped over. If you don't declare one, the default
is to use $_.
If you declare an alias variable, the first form will look like this:
for my $this_element (reverse @elements) { }
Keep in mind that $this_element (or $_ if you didn't explicitly declare an
alias variable) is an alias for the corresponding list element, not a copy
of it. That means that assigning a value to the alias will in fact change
the value of the corresponding list element.
There are many situations where such an alias is all you need, because you
want to do something to each element in a list, without needing to know or
care about its index within the list.
If you're writing code that needs a counter variable, or needs more than
simple one-at-a-time increments (processing every third element, for
example), then you should use the second form - that's what it's for, no
pun intended.
Also, note that "for" and "foreach" are synonyms and either one can be used
with either style of loop. However, some folks (myself included) prefer to
use "for" for C-style loops with a counter variable, and "foreach" for Perl-
style loops with an alias variable. I also prefer to explicitly declare the
alias variable in Perl-style loops, rather than using the implicit $_.
For more details and example code, have a look at "perldoc perlsyn", in the
sections imaginatively titled "For Loops" and "Foreach Loops".
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 25 Jul 2007 20:59:49 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: I am giving up perl because of assholes on clpm -- switching to Python
Message-Id: <slrnfafeds.bd3.abigail@alexandra.abigail.be>
_
Martha_Jones@tx.net (Martha_Jones@tx.net) wrote on VLXXVI September
MCMXCIII in <URL:news:0Y2dnTFHdYnENTrbnZ2dnUVZ_vrinZ2d@giganews.com>:
}} Python is a better language, with php support, anyway, but I am fed up
}} with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin
}} Perl experience for everyone.
Bullshit. Over 99.9% of the Perl users have never read a single article
in comp.lang.perl.misc, and never will.
}} Instead of being helpful, snide remarks,
}} back-biting, scare tactings, and so on proliferate and self
}} reinforce. All honest people have left this sad newsgroup. Buy bye,
}} assholes, I am not going to miss you!!!
No longer reading a newsgroup because you don't like the way people
act in the group is one thing (and a sensible thing as well), but
your action is like switching from coffee to tea because you don't
like the people in rec.food.drink.coffee.
Abigail
--
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'
------------------------------
Date: Wed, 25 Jul 2007 22:20:34 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: I am giving up perl because of assholes on clpm -- switching to Python
Message-Id: <S0Qpi.11892$zy4.7348@trndny07>
Martha_Jones@tx.net wrote:
> Python is a better language, with php support, anyway, but I am fed up
> with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin
> Perl experience for everyone. Instead of being helpful, snide remarks,
> back-biting, scare tactings, and so on proliferate and self
> reinforce. All honest people have left this sad newsgroup. Buy bye,
> assholes, I am not going to miss you!!!
Considering that your total posting history according to DejaNews consists
of exactly 3 posts (not including this last one) from 2001 to 2003 in NGs
that are so closely related to programming as pregnancy, marriage, and
cancer I believe the last sentiment is very mutual. After all, you didn't
ever leave any trace in CLPM until today.
jue
------------------------------
Date: Wed, 25 Jul 2007 14:09:42 -0700
From: James Stroud <jstroud@mbi.ucla.edu>
Subject: Re: I am giving up perl because of assholes on clpm -- switching to Python
Message-Id: <f88e6m$rbh$1@zinnia.noc.ucla.edu>
Martha_Jones@tx.net wrote:
> Python is a better language, with php support, anyway, but I am fed up
> with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin
> Perl experience for everyone. Instead of being helpful, snide remarks,
> back-biting, scare tactings, and so on proliferate and self
> reinforce. All honest people have left this sad newsgroup. Buy bye,
> assholes, I am not going to miss you!!!
>
> Martha
You have convinced me to subscribe to clpm! Sounds like it will be fun
reading.
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
------------------------------
Date: 25 Jul 2007 21:26:30 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: match string by re using some pattern
Message-Id: <5gptg6F3c52r2U1@mid.dfncis.de>
frytaz@gmail.com <frytaz@gmail.com> wrote in comp.lang.perl.misc:
> On Jul 25, 8:14 pm, Paul Lalli <mri...@gmail.com> wrote:
> > On Jul 25, 2:05 pm, "fry...@gmail.com" <fry...@gmail.com> wrote:
> >
> > > How I could recognize those patterns #one# #two# #three#
> >
> > > Can i do it like in c#, for instance
> >
> > > $match =~ s/#one#/(?<one>.*?)/;
> > > $match =~ s/#two#/(?<two>.*?)/;
> > > $match =~ s/#three#/(?<three>.*?)/;
> >
> > > then
> >
> > > $one = ${one};
> > > $two = ${two};
> > > $three = ${three};
> >
> > > But that doesn't work...
> >
> > Not until Perl 5.10, no it doesn't.
> >
> > We've already given you an implementable solution. What issue are you
> > still having with it?
> >
> > Paul Lalli
>
> There is an issue when, theres two lines in file
>
> 1 some #one# test #two# text #three#
> 2 some #two# test #one# text #three#
Okay, these are data from a file.
> then after replace by s/#(one|two|three)#/(.+?)/
>
> 1 some (.+?) test (.+?) text (.+?)
> 2 some (.+?) text (.+?) text (.+?)
Now you generate what looks like regex patterns out of the first
two lines from your file.
> then if I'm trying to match it with
>
> some O!N!E test T!W!O text T!H!R!E!E
Where is this from? Is that another line from the file?
> script will work fine only for 1st file line
> #one# should match O!N!E for instance
It becomes increasingly unclear how you would distinguish normal
text from markers such as "#one#" or "O!N!E". How is the program
supposed to identify them?
That said, the first of your patterns at least makes an honorable
attempt at matching and even capturing the mutated markers:
my $str = 'some O!N!E test T!W!O text T!H!R!E!E';
$str =~ /some (.+?) test (.+?) text (.+?)/ or die "no match\n";
print "$_\n" for $1, $2, $3;
That prints
O!N!E
T!W!O
T
The last capture is incomplete. That may take some fiddling to correct.
I am still at a loss guessing what you are really up to.
Anno
------------------------------
Date: Wed, 25 Jul 2007 20:17:14 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Math
Message-Id: <f88b4a$1r69$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Brian Blackmore
<blb8@po.cwru.edu>], who wrote in article <f86uje$3mf$1@gnus01.u.washington.edu>:
> > > > For some unfathomable reasons, Perl uses non-invertible transformations
> > > > between strings and numbers. So if your handling of numbers involves
> > > > converting them to strings, then back, the precision will be lost.
>
> > > Yes, but I would question which programming languages don't suffer
> > > from this behavior?
> > What other programming languages with multi-representation numbers do
> > you know?
> I thought we were talking about the classic `type conversion' issue.
If you mean *explicit* conversion from binary representation to string
and back, then ANY language I know can do it losslessly.
> > Nope, by C RT libraries. And the for these libraries, they do it
> > following instructions from perl.
>
> Following your advice, and checking perlnumber, what I found was what
> I said up above:
>
> "RESTRICTION: The conversions marked with "(*)" above
> involve steps performed by the C compiler. In particular,
> bugs/features of the compiler used may lead to breakage of
> some of the above rules."
I wonder whether it is the original text (written by me); might be so.
It does not make any sense; the intent is clear, but the wording is
very bad... I tried to "keep things simple", but this error is not in
that category...
> Since "native floating_point --> decimal string (*)" and
> "decimal string --> native floating point (*)" are so marked, I
> interpret that to mean that perl is at the whim of whatever C compiler
> was used.
Yes - in the sense, that usually C compiler determines which CRTL is used.
What you are missing however, that even if Perl uses CRTL functions,
they take a lot of "options". And it is the options which Perl uses
which lead to precision loss.
AND, as I said, Perl could have used some specialized functions tuned
up to its problem domain (multi-representation).
> > > whence Perl is at the mercy of the system on which it was compiled.
>
> > And this the CHOICE made by perl. It could have done the conversion
> > itself.
>
> True, but that's a bit like saying that it's output could be based on
> the TeX typesetting engine, that it's input stream should be entirely
> XMLized and should natively handle images and gestured input, and that
> it should natively translated any symbol set into the appropriate
> characters necessary to create code.
Sorry, I have no idea what was it you wanted to express here.
> Lacking a programming language where float->string conversion is
> invertible,
??? See above.
> converting to strings in any language creates a loss of
> precision, which is no difficulty to imagine given a base ten
> representation in a string in comparison to a base two representation
> for a float.
> > > Indeed, I was also thinking of something simple like 1/3, but have
> > > you an example of a language where "1/3"=1/3? Or are there so many
> > > that I'm just being dim?
>
> > Yes. E.g., see
>
> > perl -MMath::Pari=:int
>
> So perl has the ability after all, and doesn't use non-invertible
> transforms, so there are no unfathomable reasons.
Again, the way I can parse this, it makes no sense.
Hope this helps,
Ilya
------------------------------
Date: Thu, 26 Jul 2007 00:36:56 -0000
From: Robert Hicks <sigzero@gmail.com>
Subject: Re: Math
Message-Id: <1185410216.931083.248420@k79g2000hse.googlegroups.com>
So the answer is "yes" but be careful. : )
Robert
------------------------------
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 V11 Issue 681
**************************************