[32061] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3325 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 18 06:09:29 2011

Date: Fri, 18 Mar 2011 03:09:11 -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           Fri, 18 Mar 2011     Volume: 11 Number: 3325

Today's topics:
    Re: "getting" a website <Uno@example.invalid>
    Re: "getting" a website <Uno@example.invalid>
    Re: convenient module to take statistics for hashed str <ela@yantai.org>
    Re: convenient module to take statistics for hashed str <nospam.gravitalsun@hotmail.com.nospam>
    Re: DBD::mysql used to take octets into the utf8 texts  <rvtol+usenet@xs4all.nl>
    Re: FAQ 2.2 How can I get a binary version of perl? <rvtol+usenet@xs4all.nl>
        Is there any point in using a reference to an object? <news@lawshouse.org>
    Re: Is there any point in using a reference to an objec <bugbear@trim_papermule.co.uk_trim>
    Re: Is there any point in using a reference to an objec <news@lawshouse.org>
    Re: Is there any point in using a reference to an objec <tadmc@seesig.invalid>
    Re: Is there any point in using a reference to an objec <blgl@stacken.kth.se>
    Re: List assignment to array affects scalar results <derykus@gmail.com>
    Re: List assignment to array affects scalar results <xhoster@gmail.com>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@seesig.invalid
    Re: reading .ini file without using a module <alfonso.baldaserra@gmail.com>
    Re: recursive Pythagorian triples <nospam.gravitalsun@hotmail.com.nospam>
    Re: recursive Pythagorian triples <xhoster@gmail.com>
    Re: recursive Pythagorian triples <cartercc@gmail.com>
    Re: recursive Pythagorian triples <bugbear@trim_papermule.co.uk_trim>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 18 Mar 2011 02:45:30 -0600
From: Uno <Uno@example.invalid>
Subject: Re: "getting" a website
Message-Id: <8ugkdbFqdnU1@mid.individual.net>

On 03/10/2011 06:35 AM, Tad McClellan wrote:

[re-ordered, for thematic reasons}
> Uno<Uno@example.invalid>  wrote:

 > $_ is a variable.
 >
 > It cannot "return" anything.
 >
 > It does have a value though:
 >
 >      why is the value of $_ more than I wanted.
 >
 >
 > For us to answer that, we would need to know what you wanted!
 >
 > What did you want?

What I want is a reasonable discussion of perl.  My notion of 
"reasonable" might be another's notion of "highly idiomatic and usually OT."

I suspect that a default variable is something that one just has to get 
used to, like quantum mechanics.
> Most excellent! You have found the right spot.
>
>
>> q43)  How do I match on zip as well?
>
>
> By adding alternation and grouping:
>
>      (pdf|zip) # last part
>
> or, since you are already using the m//x modifier:
>
>      (               # last part (will be available in $1)
>          pdf | zip   # either one of these
>      )
>
> or, if you don't need to capture:
>
>      (?:              # last part
>           pdf | zip   # either one of these
>      )
>

>
>
$ perl gurl9.pl
http://www.germanresistance.com/documents/Intro_to_Bonhoeffer.pdf
success is 200
http://www.germanresistance.com/documents/Chronology_of_the_life_of_Dietrich_Bonhoeffer.pdf
success is 200
http://www.germanresistance.com/documents/Bonhoeffer_on_Abortion.pdf
success is 200
http://www.germanresistance.com/documents/Luther_Bonhoeffer_and_Revolution.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_and_the_Russian_Religious_Renaissance.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_the_resistance_and_the_two_kingdoms.pdf
success is 200
http://www.germanresistance.com/documents/Pius_XII_and_the_Jews.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_and_the_German_Resistance_'95.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_and_Liberalism.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_and_Canossa.pdf
success is 200
http://www.germanresistance.com/documents/Invidious_Comparisons.pdf
success is 200
http://www.germanresistance.com/documents/Agent_of_Grace.pdf
success is 200
http://www.germanresistance.com/documents/The_stereotyping_of_Dietrich_Bonhoeffer.pdf
success is 200
http://www.germanresistance.com/documents/From_Dietrich_Bonhoeffer’s_Wedding_Sermon.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_and_the_Theology_of_the_Cross.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_on_Authority.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_and_the_Formula_of_Concord.pdf
success is 200
http://www.germanresistance.com/documents/The_German_Resistance_60_years.pdf
success is 200
http://www.germanresistance.com/documents/Dietrich_Bonhoeffer_and_Karl_Barth.pdf
success is 200
http://www.germanresistance.com/documents/Luther_and_Bonhoeffer_misunderstood.pdf
success is 200
http://www.germanresistance.com/documents/The_German_Resistance_and_Dietrich_Bonhoeffer_'07.pdf
success is 200
http://www.germanresistance.com/documents/GermanResistanceV2.zip
success is 200
$ cat gurl9.pl
#!/usr/bin/perl -w
# gurl - get content from an url

use LWP::Simple;
require HTML::TokeParser;

my $file = "bonhoeffer2";
my $URL = 'http://germanresistance.com/index-of-papers/';


my $p = HTML::TokeParser->new(bonhoeffer2);


   while (my $token = $p->get_tag("a")) {
       my $url = $token->[1]{href} || "-";
       if ($url =~ 
"http://www.germanresistance.com/documents.*(pdf|zip)" ) {
print "$url\n";

my $success = getstore( $url, "/pdfs/$url" );
print "success is $success\n";
}
}

So why am I told that 200 is my success when I have none?
-- 
Uno


------------------------------

Date: Fri, 18 Mar 2011 02:57:12 -0600
From: Uno <Uno@example.invalid>
Subject: Re: "getting" a website
Message-Id: <8ugl39Fv7fU1@mid.individual.net>

On 03/10/2011 04:24 AM, Jürgen Exner wrote:
> perldoc perlretut


$ perldoc perlretut
You need to install the perl-doc package to use this program.
$

Apparently, perl documentation doesn't survive a re-install, necessarily.
-- 
Uno


------------------------------

Date: Thu, 17 Mar 2011 17:22:36 -0700
From: "ela" <ela@yantai.org>
Subject: Re: convenient module to take statistics for hashed structures?
Message-Id: <ilsg9t$iiq$1@ijustice.itsc.cuhk.edu.hk>


"George Mpouras" <nospam.gravitalsun@hotmail.com.nospam> wrote in message 
news:ilqvvv$nui$1@news.ntua.gr...
>
> # This one meet your requirements
> # It can handle even more data than the previous versions

I'm sorry to report that when I feed the threshold to be smaller than 50, 
e.g. 10, the result will be

H=2,6;

This result, although passes the threshold, in fact I only needs the largest 
one, i.e. 3 (50% abundant), which is not reported and then why does 
statement

foreach my $RANK (keys %{$data{$_[0]}->[$i]})
{
return [$col[$i], $data{$_[0]}->[$i]->{$RANK}] if $RANK >= $_[1]
}

can return two values? when one of the "$RANK" fulfill the requirement, I 
think the subroutine will return.... 




------------------------------

Date: Thu, 17 Mar 2011 13:14:05 +0200
From: "George Mpouras" <nospam.gravitalsun@hotmail.com.nospam>
Subject: Re: convenient module to take statistics for hashed structures?
Message-Id: <ilsqcs$2s6o$1@news.ntua.gr>


"ela" <ela@yantai.org> wrote in message 
news:ilsg9t$iiq$1@ijustice.itsc.cuhk.edu.hk...
>
> "George Mpouras" <nospam.gravitalsun@hotmail.com.nospam> wrote in message 
> news:ilqvvv$nui$1@news.ntua.gr...
>>
>> # This one meet your requirements
>> # It can handle even more data than the previous versions
>
> I'm sorry to report that when I feed the threshold to be smaller than 50, 
> e.g. 10, the result will be
>
> H=2,6;
>
> This result, although passes the threshold, in fact I only needs the 
> largest one, i.e. 3 (50% abundant), which is not reported and then why 
> does statement
>
> foreach my $RANK (keys %{$data{$_[0]}->[$i]})
> {
> return [$col[$i], $data{$_[0]}->[$i]->{$RANK}] if $RANK >= $_[1]
> }
>
> can return two values? when one of the "$RANK" fulfill the requirement, I 
> think the subroutine will return....
>



# You only have to change one line for this behavior
#
#  foreach my $RANK (sort {$b <=> $a} keys %{$data{$_[0]}->[$i]})
#
# All together again is









my @col;
my %data;
ReadData();

$_ = query('01',10);
print "Field=$_->[0],Value=@{$_->[1]}\n";



sub ReadData
{
while (<DATA>) { chomp;
my @a = split /\s*\|\s*/, $_, -1;
if (-1 == $#col){push @col, @a[1..$#a] ;next}
unless (1+$#col==$#a) {warn "Skip line number $. \"$_\" because it have
".(1+$#a)." fields, while it should have ".(1+$#col)."\n";next}
$data{$a[0]}->[0]++;
for(my $i=1;$i<=$#a;$i++){$data{$a[0]}->[1]->[$i-1]->[0]->{$a[$i]}++}}

 foreach my $id (keys %data)
 {
  foreach my $f ( @{$data{$id}->[1]} )
  {
   foreach my $v ( keys %{$f->[0]} )
   {
   push @{ $f->[1]->{int 100*( $f->[0]->{$v}/$data{$id}->[0])} }, $v
   }

   # remove unnecessary structures
  $f = $f->[1]
  }

 # remove unnecessary structures
 $data{$id} = $data{$id}->[1]
 }

#use Data::Dumper; print Dumper(\%data);exit;
}


sub query
{
 for(my $i=$#{$data{$_[0]}}; $i>=0; $i--)
 {
  foreach my $RANK (sort {$b <=> $a} keys %{$data{$_[0]}->[$i]})
  {
  return [$col[$i], $data{$_[0]}->[$i]->{$RANK}] if $RANK >= $_[1]
  }
 }

['',[]]
}


__DATA__
ID|B|C|D|E|F|G|H
01|3|7|9|3|4|2|3
01|3|7|9|3|4|2|2
01|3|7|9|5|8|6|6
01|3|7|9|3|4|2|3
02|4|7|9|3|4|2|1
02|4|7|9|3|4|2|2
02|4|7|9|3|4|2|3
02|4|7|9|3|4|2|3






------------------------------

Date: Thu, 17 Mar 2011 13:28:53 +0100
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: DBD::mysql used to take octets into the utf8 texts but no more in mariadb
Message-Id: <4d81fe85$0$41117$e4fe514c@news.xs4all.nl>

On 2011-03-15 00:54, Peter Vereshagin wrote:

> Output coming 3rd is my solution and the 4th is yours ( and not only yours ).

I didn't give you any solution, just a pointer to 'SET NAMES'.


> whom of software authors should I ask about that strange behavior?

There is nothing strange about that behavior, it all works as documented.

You need to check (and compare) the character set settings on all levels 
(connection, database, table, column), to find out where the differences 
come from.

Good reads are:
http://dev.mysql.com/doc/refman/5.1/en/charset.html
http://code.openark.org/blog/mysql/mysqls-character-sets-and-collations-demystified

Another confused person:
http://www.bluebox.net/news/2009/07/mysql_encoding

-- 
Ruud


------------------------------

Date: Thu, 17 Mar 2011 13:40:02 +0100
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: FAQ 2.2 How can I get a binary version of perl?
Message-Id: <4d820122$0$41113$e4fe514c@news.xs4all.nl>

On 2011-03-17 04:02, brian d foy wrote:
> In article<4d7e8ce5$0$81474$e4fe514c@news.xs4all.nl>, Dr.Ruud
> <rvtol+usenet@xs4all.nl>  wrote:

>> Another nice one:
>>
>>     Citrus Perl
>>     http://www.cava.co.uk/
>
> Has anyone used this? Is it good enough to be in the FAQ?

I saw that Johan Vromans uses it for Eekboek.
Then it must be good enough for everybody.
:)

http://wiki.eekboek.nl/mediawiki/index.php?title=Platform:MacOSX


http://www.cava.co.uk/citrusperl/osx32.html
Citrus Perl includes the minimum additional modules needed to support:

Wx
DBD::SQLite
DBD::Pg
DBD::mysql

To me it looks like a Strawberry with graphics, and databases.

-- 
Ruud


------------------------------

Date: Thu, 17 Mar 2011 09:23:17 +0000
From: Henry Law <news@lawshouse.org>
Subject: Is there any point in using a reference to an object?
Message-Id: <uaCdnf23rfqbThzQnZ2dnUVZ8vGdnZ2d@giganews.com>

My application has need to create a hierarchy of objects, all of the 
same type: $obj_a "owns" (or contains) $obj_b and $obj_c; $obj_c in turn 
owns d, e and f, and so on.  It's necessary to be able to go forward 
among siblings (b -> c, or d -> e -> f) and also to be able to go "down" 
to the first child (a to b, c to d).

My immediate idea was to include in the object's own hash references to 
the next object, whether "down" or "forward", thus

   $self->{first_child} = \$first_child_object;
   $self->{next_sibling} = \$next_sibling_object;

but it occurs to me that the object variable is itself just a reference, 
so that

   $self->{first_child} = $first_child_object;

would have the same effect.  Most importantly I don't want to *copy* 
$first_child_object, just provide a way of getting to it, and its 
methods, from $self.  (You can see that I'm somewhat of a novice at OO 
Perl).

Is my thinking correct?   Or is there a different and better way of 
doing what I want?

-- 

Henry Law            Manchester, England


------------------------------

Date: Thu, 17 Mar 2011 10:28:30 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Is there any point in using a reference to an object?
Message-Id: <K82dnQUxBOLSfxzQnZ2dnUVZ8jCdnZ2d@brightview.co.uk>

Henry Law wrote:
> My application has need to create a hierarchy of objects, all of the
> same type: $obj_a "owns" (or contains) $obj_b and $obj_c; $obj_c in turn
> owns d, e and f, and so on. It's necessary to be able to go forward
> among siblings (b -> c, or d -> e -> f) and also to be able to go "down"
> to the first child (a to b, c to d).
>
> My immediate idea was to include in the object's own hash references to
> the next object, whether "down" or "forward", thus
>
>
> $self->{next_sibling} = \$next_sibling_object;
>
> but it occurs to me that the object variable is itself just a reference,
> so that
>
> $self->{first_child} = $first_child_object;
>
> would have the same effect. Most importantly I don't want to *copy*
> $first_child_object, just provide a way of getting to it, and its
> methods, from $self. (You can see that I'm somewhat of a novice at OO
> Perl).
>
> Is my thinking correct? Or is there a different and better way of doing
> what I want?

Assuming that you're "near" to a solution, I will point out
that your scalars (the variable with a preceding $) are already
references to hashes, equivalent to a pointer in C.

I suspect you've come from a Java background, where "objects"
are actually references to objects. Since this is ALWAYS
the case in Java, most Java programmers just call them "objects".

Back to perl - since your scalars are already references (to hashes)
you can treat them as you would in Java, or as you would pointers in 'C'.

In particular, unless you trying to do something Macintosh like
("Handles", allowing memory motion), you don't need to do

     $self->{first_child} = \$first_child_object;

As you worked out:

     $self->{first_child} = $first_child_object;

is fine.

   BugBear


------------------------------

Date: Thu, 17 Mar 2011 10:41:00 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: Is there any point in using a reference to an object?
Message-Id: <8d6dnTYRp5OjeBzQnZ2dnUVZ7tCdnZ2d@giganews.com>

On 17/03/11 10:28, bugbear wrote:
> In particular, unless you trying to do something Macintosh like
> ("Handles", allowing memory motion), you don't need to do
>
> $self->{first_child} = \$first_child_object;
>
> As you worked out:
>
> $self->{first_child} = $first_child_object;

Excellent; thank you for confirming what I'd worked out.  I'm conscious 
that "you can't just make stuff up and hope that it will work" ...

(Is that (c) Tad McClellan?)

-- 

Henry Law            Manchester, England


------------------------------

Date: Thu, 17 Mar 2011 11:30:11 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Is there any point in using a reference to an object?
Message-Id: <slrnio4df5.3hc.tadmc@tadbox.sbcglobal.net>

Henry Law <news@lawshouse.org> wrote:

[snip]

> Excellent; thank you for confirming what I'd worked out.  I'm conscious 
> that "you can't just make stuff up and hope that it will work" ...
>
> (Is that (c) Tad McClellan?)


Much as I would like to, I cannot lay claim to that one. 

It is due to MJD:

    BECAUSE YOU CAN'T JUST MAKE SHIT UP AND EXPECT THE COMPUTER TO 
    MAGICALLY KNOW WHAT YOU MEAN, RETARDO!


    http://groups.google.com/groups/search?as_umsgid=6n69o5%247m6%241%40monet.op.net



-- 
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: Thu, 17 Mar 2011 19:33:38 +0100
From: Bo Lindbergh <blgl@stacken.kth.se>
Subject: Re: Is there any point in using a reference to an object?
Message-Id: <iltk60$pcf$1@speranza.aioe.org>

In article <slrnio4df5.3hc.tadmc@tadbox.sbcglobal.net>,
 Tad McClellan <tadmc@seesig.invalid> wrote:
> It is due to MJD:
> 
>     BECAUSE YOU CAN'T JUST MAKE SHIT UP AND EXPECT THE COMPUTER TO 
>     MAGICALLY KNOW WHAT YOU MEAN, RETARDO!

The problem with this is that Perl has so much dwimmery in it
that you often _can_ make shit up successfully.


/Bo Lindbergh


------------------------------

Date: Wed, 16 Mar 2011 22:00:26 -0700 (PDT)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: List assignment to array affects scalar results
Message-Id: <be0c1bd2-c1a2-4233-8839-e560f864eef3@11g2000prf.googlegroups.com>

On Mar 16, 3:39=A0pm, Mark <goo...@markginsburg.com> wrote:
> Why does the introduction of the assignment to @b affect the value of
> $cnt?
>
> use strict;
> use warnings;
>
> my $cnt;
> my($x,$y,$z);
> my(@ary) =3D qw(a b c d e);
>
> $cnt =3D ( ($x,$y,$z) =3D @ary );
> print "cnt=3D$cnt\n"; # produces 5
>
> my @b;
> $cnt =3D ( @b =3D ($x,$y,$z) =3D @ary );
> print "cnt=3D$cnt\n"; # produces 3

See:  perldoc perldata  and its explanations
of lists and list vs. scalar context

Specifically, from that doc:

  List assignment in scalar context returns the
  number of elements produced by the expression
  on the right side of the assignment:

   $x =3D($foo,$bar) =3D (3,2,1));# set $x to 3, not 2
  ...

Similarly, in your first case, that evaluates to 5.
The eventual array assignment to @b in the second
case is also evaluated in scalar contest. The first
three elements in @ary are assigned to ($x,$x,$z)
and the additional elements in @ary are discarded.
@b is then assigned ($x,$y,$z) and then is evaluated
in scalar  context to yield 3.

--
Charles DeRykus


------------------------------

Date: Thu, 17 Mar 2011 17:21:37 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: List assignment to array affects scalar results
Message-Id: <4d82a427$0$32202$ed362ca5@nr5-q3a.newsreader.com>

Mark wrote:
> Why does the introduction of the assignment to @b affect the value of
> $cnt?

It is not the array that does it, it is the extra assignment.

> use strict;
> use warnings;
> 
> my $cnt;
> my($x,$y,$z);
> my(@ary) = qw(a b c d e);
> 
> 
> $cnt = ( ($x,$y,$z) = @ary );

The list assignment is evaluated in a scalar context.

> print "cnt=$cnt\n"; # produces 5
> 
> my @b;
> $cnt = ( @b = ($x,$y,$z) = @ary );

The initial list assignment is evaluated in a *list* context, not a 
scalar context.  The magic only applies to list assignment in a scalar 
context.

You get the same thing using a non-array:

$cnt = ( ($x1,$x2,$x3) = ($x,$y,$z) = @ary );




------------------------------

Date: Fri, 18 Mar 2011 02:15:04 -0500
From: tadmc@seesig.invalid
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.9 $)
Message-Id: <F82dnXNuj8vlmx7QnZ2dnUVZ5uOdnZ2d@giganews.com>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.9 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://www.rehabitation.com/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume that they do 
       know and are being the "bad kind" of Lazy.

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan and many others on the comp.lang.perl.misc newsgroup.

-- 
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: Wed, 16 Mar 2011 23:46:06 -0700 (PDT)
From: alfonsobaldaserra <alfonso.baldaserra@gmail.com>
Subject: Re: reading .ini file without using a module
Message-Id: <2e416462-aa61-4a33-9018-4d58061b3ba8@u8g2000yqh.googlegroups.com>

> try to create the my.ini with the same data and give a shot !

it was a very serious mistake.  i am very sorry and thank you very
much for correcting me.


------------------------------

Date: Thu, 17 Mar 2011 09:11:02 +0200
From: "George Mpouras" <nospam.gravitalsun@hotmail.com.nospam>
Subject: Re: recursive Pythagorian triples
Message-Id: <ilsc4r$1i41$1@news.ntua.gr>

unfortunately ... and can not be saved 




------------------------------

Date: Wed, 16 Mar 2011 18:02:25 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: recursive Pythagorian triples
Message-Id: <4d829e72$0$32196$ed362ca5@nr5-q3a.newsreader.com>

ccc31807 wrote:
> On Mar 15, 8:12 pm, sreservoir <sreserv...@gmail.com> wrote:
>>> pythag(N) ->
>>>      [{A,B,C} ||
>>>          A<- seq(1,N),
>>>          B<- seq(1,N),
>>>          C<- seq(1,N),
>>>          A + B + C =<  N,
>>>          (A * A) + (B * B) =:= C * C].
>> that's not recursive. that's a list comprehension.
> 
> Yes, it's a list comprehension. My question was, can you write a
> Pythagorean triple function in Perl using recursion?

The above non-recursive example is what you gave to explain why you 
wanted a recursive version in Perl.  If we are not to assume that you 
are just babbling incoherently, then the most reasonable assumption is 
that you for some reason thought the above was recursive.  Otherwise 
using it as an example is just bizarre.


Xho


------------------------------

Date: Thu, 17 Mar 2011 19:44:50 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: recursive Pythagorian triples
Message-Id: <227d0147-7672-48ed-a367-bc539ff954f7@f30g2000yqa.googlegroups.com>

On Mar 16, 8:02=A0pm, Xho Jingleheimerschmidt <xhos...@gmail.com> wrote:
> The above non-recursive example is what you gave to explain why you
> wanted a recursive version in Perl. =A0If we are not to assume that you
> are just babbling incoherently, then the most reasonable assumption is
> that you for some reason thought the above was recursive. =A0Otherwise
> using it as an example is just bizarre.

You missed the point. I didn't mention the Erlang script to begin with
because it wasn't relevant to the question. I only mentioned it in the
context of providing an explanation of the original post. Perl doesn't
have list comprehensions, as far as I know, so you are correct in that
asking for a Perl script for finding Pythagoriean triples would indeed
be bizarre. But that wasn't the point.

The point was -- Can you find Pythagorean triples in Perl using
recursion? If you want a generalization, how do you solve a problem
that calls for triple recursion. PJH provided one solution that I
didn't like, but the next day I spend almost the entire day trying to
better it, and I failed. I'm not convinced that it can't be done in a
simpler way, but I don't think I can do it.

To make a larger point, Paul Graham has pointed out that different
languages are different, plugging Lisp. MJD showed how to write Perl
using Lisp-like constructs. Someone, I don't remember who, commented
that Perl can do everything Lisp can do except for Lisp macros.
Several years ago, Time Bray authored a famous blog attempted to use
Erlang to construct a database application, and concluded that Erlang
wasn't suited for the job, yet CouchDB uses Erlang.

And please don't point out that Erlang is derived from Prolog, not
Lisp. I know that. I also know that Lisp has iterative constructs, but
Erlang doesn't. The tie to Erlang was that the particular example used
list comprehensions, and I wondered how you could use Perl to do the
same kind of job, and recursion was as close as i could come to
Erlang's list comprehensions.

In one sense, this thread is simply an idle conversation, something
that you kick around in the break room. In another sense, discussing
how a particular algorithm can be implemented in Perl (or any other
language) is the kind of thing that 'sharpens the axe.'

If you think it's 'incoherent babble' you are free to ignore the
thread. If you think you can code a recursive Pythagorean triple
finder in Perl, you are welcome to try.

CC.


------------------------------

Date: Fri, 18 Mar 2011 09:16:16 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: recursive Pythagorian triples
Message-Id: <ZtednZg1KtV9vx7QnZ2dnUVZ8mOdnZ2d@brightview.co.uk>

ccc31807 wrote:

>
> If you think it's 'incoherent babble' you are free to ignore the
> thread. If you think you can code a recursive Pythagorean triple
> finder in Perl, you are welcome to try.

Well it would be trivial (and opintless) to express
the nested loops in a recursive form. Would that satisfy
your request>

   BugBear


------------------------------

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 3325
***************************************


home help back first fref pref prev next nref lref last post