[32079] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3343 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 4 14:09:26 2011

Date: Mon, 4 Apr 2011 11:09:09 -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           Mon, 4 Apr 2011     Volume: 11 Number: 3343

Today's topics:
    Re: how about for(<>){...} instead of while(<>){...} <arjenbax@googlemail.com>
    Re: how about for(<>){...} instead of while(<>){...} <jl_post@hotmail.com>
    Re: How do I pass values from a .pl to a .pm. <sherm.pendley@gmail.com>
    Re: How do I pass values from a .pl to a .pm. <jurgenex@hotmail.com>
    Re: How do I pass values from a .pl to a .pm. <cartercc@gmail.com>
        How useful is Perl for classical statistics? <idostatistics@gmail.com>
    Re: How useful is Perl for classical statistics? <butler@utsc.utoronto.ca>
    Re: How useful is Perl for classical statistics? <vilain@NOspamcop.net>
    Re: How useful is Perl for classical statistics? <xhoster@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 4 Apr 2011 05:04:46 -0700 (PDT)
From: ilovelinux <arjenbax@googlemail.com>
Subject: Re: how about for(<>){...} instead of while(<>){...}
Message-Id: <242aa9f0-e0a1-441e-aa9c-30e1e533cb92@p16g2000vbi.googlegroups.com>

On 31 mrt, 19:21, Jean-Luc <jl_p...@hotmail.com> wrote:
> =A0 =A0This is not so for while-loops. =A0If $_ was "hello" right before =
the
> while-loop, after the while-loop it will be set to the last line
> returned from <> (accounting to any changes you make to $_ inside the
> loop, of course).

Not entirely correct.

while(<>) { }
is, as  Jean-Luc correctly points out, equivalent to
while (defined($_=3D<>)) { }
and when this loop ends, $_ will be undefined.


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

Date: Mon, 4 Apr 2011 08:13:15 -0700 (PDT)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: how about for(<>){...} instead of while(<>){...}
Message-Id: <579b4286-0f88-48e6-bd79-23e32e1646fe@dn9g2000vbb.googlegroups.com>

On Apr 4, 6:04=A0am, ilovelinux <arjen...@googlemail.com> wrote:
>
> while(<>) { }
> is, as =A0Jean-Luc correctly points out, equivalent to
> while (defined($_=3D<>)) { }
> and when this loop ends, $_ will be undefined.


   Oh, right... while(<>) breaks out once it sets $_ to undefined
(which is one iteration after $_ is set to the last line).

   Regardless, $_ won't be restored to the value it was when the
while(<>) loop was encountered (unless, of course, it was already
undefined).

   Thanks for pointing that out.

   -- Jean-Luc


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

Date: Sat, 02 Apr 2011 08:14:32 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: How do I pass values from a .pl to a .pm.
Message-Id: <m2d3l4c0k7.fsf@sherm.shermpendley.com>

RedGrittyBrick <RedGrittyBrick@spamweary.invalid> writes:

> In addition, what you might want to do is make A.pm be
> object-oriented.

That was my thought as well. When you start thinking in terms of giving
all the functions in A access to a variable, you're really thinking about
methods and instance variables.

> Read `perldoc perltoot`

Definitely.

sherm--

-- 
Sherm Pendley
                                   <http://camelbones.sourceforge.net>
Cocoa Developer


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

Date: Sat, 02 Apr 2011 06:45:15 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How do I pass values from a .pl to a .pm.
Message-Id: <4t9ep6hk2270b2n6ilik1barqut4kvh811@4ax.com>

RedGrittyBrick <RedGrittyBrick@spamweary.invalid> wrote:
>On 01/04/2011 07:50, Ironhide wrote:
>> With the code below how do I send the value of $value_to_pass to A.pm,
>> so that sub-routines in A.pm can use them?
>
>In addition, what you might want to do is make A.pm be object-oriented. 

Or at the very least if you prefer a procedural interface have a
function "set()" to not break the data abstraction that the module
provides:

	A::set($value_to_pass) 

jue


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

Date: Sat, 2 Apr 2011 17:50:37 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: How do I pass values from a .pl to a .pm.
Message-Id: <1115f2d6-6289-4bb1-a322-f7fe78c00d40@w21g2000yqm.googlegroups.com>

On Apr 1, 1:50 am, Ironhide <gourabba...@gmail.com> wrote:
> With the code below how do I send the value of $value_to_pass to A.pm,
> so that sub-routines in A.pm can use them?

Why would you want to do that? A module essentially contains common
code that other code can call. For example, if you had a need to
configure the environment for several scripts, say to set $username,
$password, and $ipaddress, so that the script could communicate with
some server, you might want to put the configuration functionality in
a module, like this:

package commoncode;
sub configure
{
  my $script = shift;
  my %CONFIG;
  # open configuration file and set variables
  return \%CONFIG;
}

while in your script that needs to be configured, you might do this:

use commoncode;
my $CONFIG = commoncode::configure('FTPscript');
my $username = $CONFIG->{username};
 ... and so on.

The point is that your module contains code that you use in your
scripts, and you pass and return values to that code in the same way
you would as if the code were in the script itself.

I may be dumb, dumber, and dumbest, but I can't see how your question
makes any sense.

CC.


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

Date: Sat, 2 Apr 2011 17:50:13 -0700 (PDT)
From: robert <idostatistics@gmail.com>
Subject: How useful is Perl for classical statistics?
Message-Id: <b1703e27-0776-4085-b18c-f542462c4637@v8g2000yqb.googlegroups.com>


How useful is Perl for standard statistics, on data coming out of a
database,
say regression, logistic, chisquare, etc. etc.

Robert

http://code.google.com/p/vilno


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

Date: Sat, 2 Apr 2011 21:25:32 -0400
From: Ken Butler <butler@utsc.utoronto.ca>
Subject: Re: How useful is Perl for classical statistics?
Message-Id: <alpine.DEB.2.00.1104022113310.12229@ken-laptop>

On Sat, 2 Apr 2011, robert wrote:

>
> How useful is Perl for standard statistics, on data coming out of a
> database,
> say regression, logistic, chisquare, etc. etc.

I wouldn't use Perl directly for any of these, preferring something 
well-tested like R. (There is Statistics::R on CPAN that provides an 
interface to R from Perl, though I haven't used it myself.)

CPAN has a long list of Statistics:: modules, including 
Statistics::Chisquare and Statistics::MVA::MultipleRegression.

Cheers,
Ken.



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

Date: Sat, 02 Apr 2011 18:38:26 -0700
From: Michael Vilain <vilain@NOspamcop.net>
Subject: Re: How useful is Perl for classical statistics?
Message-Id: <vilain-640C6B.18382602042011@news.individual.net>

In article 
<b1703e27-0776-4085-b18c-f542462c4637@v8g2000yqb.googlegroups.com>,
 robert <idostatistics@gmail.com> wrote:

> How useful is Perl for standard statistics, on data coming out of a
> database,
> say regression, logistic, chisquare, etc. etc.
> 
> Robert
> 
> http://code.google.com/p/vilno

Define "useful".  If you found that term in a functional spec, why 
doesn't it make the programmer in you go "WTF?".

Like any other programming language, perl, php, C++, FORTRAN, etc is as 
useful as the programmer's ability to code in it.  If you don't know 
Perl, it won't be very useful to you.  If you do, there's the CPAN 
library you can peruse for modules others have written.

I found packages on descriptive statistics, regression, and chisquare.

http://search.cpan.org/search?query=Statistics&mode=module

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]




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

Date: Sat, 02 Apr 2011 18:47:58 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: How useful is Perl for classical statistics?
Message-Id: <4d97e49d$0$22873$ed362ca5@nr5-q3a.newsreader.com>

Michael Vilain wrote:
> In article 
> <b1703e27-0776-4085-b18c-f542462c4637@v8g2000yqb.googlegroups.com>,
>  robert <idostatistics@gmail.com> wrote:
> 
>> How useful is Perl for standard statistics, on data coming out of a
>> database,
>> say regression, logistic, 

What kind of regression and logistic?  Perl's a bit slow for doing heavy 
duty convergence problems.

> chisquare, etc. etc.

I probably wouldn't use Perl for doing that, unless I was already using 
Perl on that project anyway (which for me I usually am.)

Some databases have statistics engines built in.  And there is also the 
R language.

You certainly can use Perl for statistics, but unless it is already your 
favorite language, I don't see why you would choose it over other languages.



>>
>> Robert
>>
>> http://code.google.com/p/vilno
> 
> Define "useful".  If you found that term in a functional spec, why 
> doesn't it make the programmer in you go "WTF?".
> 
> Like any other programming language, perl, php, C++, FORTRAN, etc is as 
> useful as the programmer's ability to code in it.  If you don't know 
> Perl, it won't be very useful to you.  If you do, there's the CPAN 
> library you can peruse for modules others have written.
> 
> I found packages on descriptive statistics, regression, and chisquare.
> 
> http://search.cpan.org/search?query=Statistics&mode=module

Congratulations, you can search CPAN.  So can I.  I when I do, I find a 
whole lot of hits, most of which are either false positives, or low 
quality crap, or weird vanity projects that are not of general utility.

Saying you can find search results on CPAN, without providing 
testimonials about the quality or usibility of those modules, is beyond 
useless.

There is a lot of valuable stuff on CPAN.  But the best way to find is 
by referrals from knowledgeable people.  Not just groping around in the 
dark.

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


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