[31710] in Perl-Users-Digest
Perl-Users Digest, Issue: 2973 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 5 06:09:24 2010
Date: Sat, 5 Jun 2010 03:09:06 -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 Sat, 5 Jun 2010 Volume: 11 Number: 2973
Today's topics:
How does grep {$field->$_} work? <pengyu.ut@gmail.com>
Re: How does grep {$field->$_} work? (Randal L. Schwartz)
Re: How does grep {$field->$_} work? <pengyu.ut@gmail.com>
Re: How does grep {$field->$_} work? (Randal L. Schwartz)
How to switch floating decimal number char from "." to (Pete Sammet)
Re: How to switch floating decimal number char from "." <denis.m.f.mcmahon@googlemail.co.uk>
Re: How to switch floating decimal number char from "." <tadmc@seesig.invalid>
Re: ignoring namespaces? <keshlam.cat.nospam@verizon.net>
Re: NetPacket::TCP (isecc)
OpenOffice::OODoc and vertical tab barriers? <steve@staticg.com>
Simple Design and Testing Conference - Mumbai, India; J <sreekantht@gmail.com>
The usage of $_[0] <pengyu.ut@gmail.com>
Re: The usage of $_[0] <RedGrittyBrick@spamweary.invalid>
Re: Where is the document for \ (backslash operator for (Randal L. Schwartz)
Where is the document for \ (backslash operator for cre <pengyu.ut@gmail.com>
Re: Where is the document for \ (backslash operator for <xhoster@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 4 Jun 2010 16:12:57 -0700 (PDT)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: How does grep {$field->$_} work?
Message-Id: <459474b9-7ea6-4f94-8f2f-120b0708ba98@q8g2000vbm.googlegroups.com>
Hi,
In the bioperl Eutilities cookbook,
http://www.bioperl.org/wiki/HOWTO:EUtilities_Cookbook
I see the following code,
print join(',', grep {$field->$_} qw(is_date
is_singletoken is_hierarchy is_hidden is_numerical)),"\n
\n";
I'm not understand how $field->$_ work with. I'm trying to break the
above code so that I can understand. But I failed. Could you please
help generate a minimal example to help me understand the above usage
of "grep {$field->$_}"?
--
Regards,
Peng
------------------------------
Date: Fri, 04 Jun 2010 16:32:38 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: Peng Yu <pengyu.ut@gmail.com>
Subject: Re: How does grep {$field->$_} work?
Message-Id: <86eigm1ii1.fsf@red.stonehenge.com>
>>>>> "Peng" == Peng Yu <pengyu.ut@gmail.com> writes:
Peng> I'm not understand how $field->$_ work with. I'm trying to break the
Peng> above code so that I can understand. But I failed. Could you please
Peng> help generate a minimal example to help me understand the above usage
Peng> of "grep {$field->$_}"?
It'd help for you to explain what you *do* understand.
Do you know what this does:
$x = "foo":
$field->$x;
Do you know what this does:
print join ", ", grep { $_ > 5 } 1, 2, 4, 8, 16;
If you know both of them, you should be able to work out what the
combination does.
Which part of that is unclear?
print "Just another Perl hacker,"; # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Fri, 4 Jun 2010 18:35:59 -0700 (PDT)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: Re: How does grep {$field->$_} work?
Message-Id: <b901f465-f524-42df-8388-2940f5fc1f43@q33g2000vbt.googlegroups.com>
On Jun 4, 6:32=A0pm, mer...@stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "Peng" =3D=3D Peng Yu <pengyu...@gmail.com> writes:
>
> Peng> I'm not understand how $field->$_ work with. I'm trying to break th=
e
> Peng> above code so that I can understand. But I failed. Could you please
> Peng> help generate a minimal example to help me understand the above usa=
ge
> Peng> of "grep {$field->$_}"?
>
> It'd help for you to explain what you *do* understand.
>
> Do you know what this does:
>
> =A0 $x =3D "foo":
> =A0 $field->$x;
'foo' is a member function of $field, right?
------------------------------
Date: Fri, 04 Jun 2010 19:46:54 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: Peng Yu <pengyu.ut@gmail.com>
Subject: Re: How does grep {$field->$_} work?
Message-Id: <8639x219i9.fsf@red.stonehenge.com>
>>>>> "Peng" == Peng Yu <pengyu.ut@gmail.com> writes:
>> $x = "foo":
>> $field->$x;
Peng> 'foo' is a member function of $field, right?
Perl doesn't have "member functions".
However, if you mean "is this the same as $field->foo", yes. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: 04 Jun 2010 10:15:43 GMT
From: petesammet@mail.org (Pete Sammet)
Subject: How to switch floating decimal number char from "." to "," ?
Message-Id: <4c08d24f$0$6992$9b4e6d93@newsspool4.arcor-online.net>
As I found out by default Perl produces floating point number output as
123456.78
where ".78" is the fraction part of the number.
However in Europe another format is used:
123456,78
How exactly can I switch from the first to the second format?
I read a solution with
$myvar ~= tr/./,/;
but I don't want such a "afterwork" transformation.
The output should AUTOMATICALLY contain "," even during the calculation:
$num = 5/4;
print $num;
should show 1,25
Pete
------------------------------
Date: Fri, 04 Jun 2010 13:43:15 +0100
From: Denis McMahon <denis.m.f.mcmahon@googlemail.co.uk>
Subject: Re: How to switch floating decimal number char from "." to "," ?
Message-Id: <4c08f543$0$22842$bed64819@gradwell.net>
On 04/06/10 11:15, Pete Sammet wrote:
> where ".78" is the fraction part of the number.
> However in Europe another format is used:
> 123456,78
First hit of google for "perl locale" looked relevant.
Rgds
Denis McMahon
------------------------------
Date: Fri, 04 Jun 2010 08:10:57 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: How to switch floating decimal number char from "." to "," ?
Message-Id: <slrni0huet.8tq.tadmc@tadbox.sbcglobal.net>
Pete Sammet <petesammet@mail.org> wrote:
> However in Europe another format is used:
>
> 123456,78
"Europe" is many many locales. I will assume czechoslovakia as it
is one of those that use comma as the decimal point.
> How exactly can I switch from the first to the second format?
perldoc perllocale
----------------------------
#!/usr/bin/perl
use warnings;
use strict;
use locale;
use POSIX qw(locale_h LC_NUMERIC);
setlocale(LC_NUMERIC, "cs_CZ");
print 5/4, "\n";
----------------------------
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Fri, 04 Jun 2010 21:21:37 -0400
From: Joe Kesselman <keshlam.cat.nospam@verizon.net>
Subject: Re: ignoring namespaces?
Message-Id: <huc8qq$m7m$1@news.eternal-september.org>
bugbear wrote:
>> If at all possible, I really recommend hammering on people to fix the
>> documents and use namespaces correctly.
>
> Too late. Legacy applications and legacy files make this impossible.
Understood. As I say, that's going to continue to add to their costs in
the future, but if they can't/won't get everything fixed now, that's
their choice.
"The customer is not always right. The customer is the one with the
money. Sometimes you have to choose between being right and getting the
money."
(This is one reason for always having file formats -- in XML or any
other representation -- carry version numbers. That gives you some hope
of being able to recognize newer data, and process it more efficiently,
while still supporting the "quirks mode" needed by older/sloppier
instances.)
--
Joe Kesselman,
http://www.love-song-productions.com/people/keshlam/index.html
{} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
/\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
------------------------------
Date: Fri, 4 Jun 2010 23:03:32 +0200
From: pbnew@tin.it (isecc)
Subject: Re: NetPacket::TCP
Message-Id: <1jjl40d.fdibt380o8y6N%pbnew@tin.it>
eh...
the solution is: SNAPLEN
;-)
------------------------------
Date: Fri, 4 Jun 2010 10:43:43 -0700 (PDT)
From: Steve <steve@staticg.com>
Subject: OpenOffice::OODoc and vertical tab barriers?
Message-Id: <374e5650-b7f5-4144-ad6d-bfd425b07d33@z15g2000prh.googlegroups.com>
I was wondering if it was possible to use this module to create an
open office document with those verticle tab barriers (when you click
on the horizontal ruler at the top you can set them). If this is not
possible, is it possible to save a .odt file that has these barriers
and use it as a template for an output file?
------------------------------
Date: Fri, 4 Jun 2010 10:26:34 -0700 (PDT)
From: SD <sreekantht@gmail.com>
Subject: Simple Design and Testing Conference - Mumbai, India; June 26-27 2010
Message-Id: <28340b99-8f20-472e-bde6-4f46505a1152@j36g2000prj.googlegroups.com>
Simple Design and Testing Conference - Mumbai, India; June 26-27 2010
http://sdtconf.com/
SDTConf is an all open space conference providing software
practitioners a platform to meet face-to-face and discuss/demonstrate
simple design & testing principles/approaches.
No Marketing talks, no non-sense. All you get is a set of great
practitioners interested in peer-to-peer learning and exploration.
* What: Open Space Conference on Simple Design & Testing practices
* Where: Directiplex, Mumbai, India
* When: June 26th and 27th 2010
* Who: Software Practitioners (Developers, Testers, UX
Designer...)
* Cost: Free, but (Position Paper required!)
SDT Conf India 2010 is our fifth annual conference. Check out the past
conference SDT Conf 2006, 2007, 2008 and 2009 details.
More details about the conference are available on the FAQs page.
Wondering what an open space is? Visit About page for more details on
Open Space.
S C H E D U L E
Saturday, June 26th, 2010
* 08:30 AM - Registrations and Breakfast
* 09:00 AM - Topics & Timeslots
* 10:00 AM - Break
* 10:15 AM - Session 1
* 11:15 AM - Break
* 11:30 AM - Session 2
* 12:30 PM - Lunch
* 02:00 PM - Session 3
* 03:00 PM - Break
* 03:15 PM - Session 4
* 04:15 PM - Break
* 04:30 PM - Session 5
* 05:30 PM - Lightening Talks
* 06:30 PM - Social Outing
Sunday, June 27th, 2010
* 08:30 AM - Breakfast
* 09:00 AM - Lightening Talks
* 10:00 AM - Break
* 10:15 AM - Topics & Timeslots
* 11:00 AM - Break
* 11:15 AM - Session 6
* 12:30 PM - Lunch
* 01:30 PM - Session 7
* 02:30 PM - Break
* 02:45 PM - Session 8
* 03:45 PM - Break
* 04:00 PM - Retrospective and Final Address
* 05:00 PM - Tear Down
We have facilities to enable 5 parallel sessions. Two discussion
oriented sessions and three hands-on-session.
------------------------------
Date: Fri, 4 Jun 2010 08:20:00 -0700 (PDT)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: The usage of $_[0]
Message-Id: <8c32103a-1c29-4018-a21c-d397ff95fc16@i31g2000yqm.googlegroups.com>
I think that $_[0] should give me 'a' in the following example. But it
doesn't. Could you help understand why? How to get the first argument?
$ ./main.pl
ab
b
$ cat main.pl
#!/usr/bin/env perl
use strict;
use warnings;
sub mysub {
print @_, "\n";
print $_[0], print $_[1], "\n";
}
mysub 'a', 'b';
------------------------------
Date: Fri, 04 Jun 2010 16:36:08 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: The usage of $_[0]
Message-Id: <4c091d6a$0$12173$fa0fcedb@news.zen.co.uk>
On 04/06/2010 16:20, Peng Yu wrote:
> I think that $_[0] should give me 'a' in the following example. But it
> doesn't. Could you help understand why? How to get the first argument?
>
> $ ./main.pl
> ab
> b
>
> $ cat main.pl
> #!/usr/bin/env perl
>
> use strict;
> use warnings;
>
> sub mysub {
> print @_, "\n";
> print $_[0], print $_[1], "\n";
print $_[0], $_[1], "\n";
> }
>
> mysub 'a', 'b';
--
RGB
------------------------------
Date: Fri, 04 Jun 2010 08:28:42 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Where is the document for \ (backslash operator for creating a reference)
Message-Id: <86r5km24wl.fsf@red.stonehenge.com>
>>>>> "Peng" == Peng Yu <pengyu.ut@gmail.com> writes:
Peng> I think that the document for \ can be found in man perlop. But there
Peng> are too many '\'s, and I don't find where the description of backslash
Peng> operator is. Would you please point me which section to look at? Or
Peng> '\' is discussed in some other man page?
The reference doc is at "perldoc perlref". There's also a number of
tutorials on references in the standard doc set.
print "Just another Perl hacker,"; # the original!
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Fri, 4 Jun 2010 08:05:30 -0700 (PDT)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: Where is the document for \ (backslash operator for creating a reference)
Message-Id: <ed4caadc-1b62-4985-afe4-c67451564811@e5g2000yqn.googlegroups.com>
I think that the document for \ can be found in man perlop. But there
are too many '\'s, and I don't find where the description of backslash
operator is. Would you please point me which section to look at? Or
'\' is discussed in some other man page?
------------------------------
Date: Fri, 04 Jun 2010 22:12:05 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: Where is the document for \ (backslash operator for creating a reference)
Message-Id: <4c09e6f5$0$9048$ed362ca5@nr5-q3a.newsreader.com>
Peng Yu wrote:
> I think that the document for \ can be found in man perlop. But there
> are too many '\'s, and I don't find where the description of backslash
> operator is. Would you please point me which section to look at? Or
> '\' is discussed in some other man page?
It is both the 1st and the 6th backslash in perlop (my version, of
course, can't speak for yours).
Symbolic Unary Operators
.....
Unary "\" creates a reference to whatever follows it. See perlreftut
and perlref. Do not confuse this behavior with the behavior of back-
slash within a string, although both forms do convey the notion of pro-
tecting the next thing from interpolation.
Xho
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 2973
***************************************