[16072] in Perl-Users-Digest
Perl-Users Digest, Issue: 3484 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 26 18:11:02 2000
Date: Mon, 26 Jun 2000 15:10:31 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962057431-v9-i3484@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 26 Jun 2000 Volume: 9 Number: 3484
Today's topics:
Local & anonymous arrays <cdinchau@artsci.wustl.edu>
Re: Local & anonymous arrays (Bart Lateur)
Re: Local & anonymous arrays (Abigail)
Re: Local & anonymous arrays (Randal L. Schwartz)
LWP suds <abaxaba@my-deja.com>
Re: LWP suds (Randal L. Schwartz)
Re: matching question (http related) <tina@streetmail.com>
Net::FTP export error? <grichard@uci.edu>
Re: Net::FTP export error? <care227@attglobal.net>
Net::FTP not on CPAN <grichard@uci.edu>
Re: Net::FTP not on CPAN <care227@attglobal.net>
Re: Net::FTP not on CPAN <grichard@uci.edu>
Re: Net::FTP not on CPAN nfin8axs@hotmail.com
Re: Net::FTP not on CPAN <tony_curtis32@yahoo.com>
Re: Net::FTP not on CPAN (Abigail)
Re: Newbie question about subroutines... <DNess@Home.Com>
Re: Newbie question about subroutines... (Bart Lateur)
Re: Newbie question about subroutines... <DNess@Home.Com>
Re: Newbie question about subroutines... (Bart Lateur)
Re: NT or Unix at runtime <lwaibel@cwia.com>
Re: Number of Unique Values <csorensen@uptimeresources.net>
Re: Number of Unique Values newsposter@cthulhu.demon.nl
Re: Number of Unique Values (Abigail)
Re: Number of Unique Values (Abigail)
Re: Number of Unique Values <billy@arnis-bsl.com>
Re: Number of Unique Values <lauren_smith13@hotmail.com>
perl 5.6: bug with -0777 slurping? ()
Re: perl 5.6: bug with -0777 slurping? <rootbeer@redcat.com>
Perl Chat Program Help malverian@hotmail.com
Perl for Palm ? <ddevilliers@lando.co.za>
Perl/Tk--help with binding an even <alager@csuchico.edu>
Re: Perl/Tk--help with binding an even <aqumsieh@hyperchip.com>
Re: Perl/Tk--help with binding an even <alager@csuchico.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 26 Jun 2000 13:15:34 -0500
From: Christian <cdinchau@artsci.wustl.edu>
Subject: Local & anonymous arrays
Message-Id: <Pine.SOL.3.96.1000626125648.22980A-100000@ascc.artsci.wustl.edu>
Hi,
I was wondering how local and anonymous array references interact. I'm
writing an `othello-like' game anw want to pass $board to the compuer_AI
while protecting it from modification. Will local protect the original
$board, or must I do an explicit (element by element) copy?
## -- begin code snippit -- ##
$board = [[0,0,0,0],[0,1,-1,0],[0,-1,1,0],[0,0,0,0];
computer_AI($board);
sub computer_AI {
local $board_AI = shift;
# Do some stuff that alters $board_AI
}
## -- end code snippit -- ##
Laters,
Christian
--
</transmission>
NO CARRIER
------------------------------
Date: Mon, 26 Jun 2000 19:03:34 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Local & anonymous arrays
Message-Id: <395aa749.10573007@news.skynet.be>
Christian wrote:
>I was wondering how local and anonymous array references interact. I'm
>writing an `othello-like' game anw want to pass $board to the compuer_AI
>while protecting it from modification. Will local protect the original
>$board, or must I do an explicit (element by element) copy?
I think so. You need a "deep copy". See the code snippet from Randal
Schwartz' article at
<http://www.stonehenge.com/merlyn/UnixReview/col30.html>:
Here it is:
sub deep_copy {
my $this = shift;
if (not ref $this) {
$this;
} elsif (ref $this eq "ARRAY") {
[map deep_copy($_), @$this];
} elsif (ref $this eq "HASH") {
+{map { $_ => deep_copy($this->{$_}) } keys %$this};
} else { die "what type is $_?" }
}
I think it would be worth it turning this code into a little module. The
only snag is that it doesn't work, as is, with objects (ak bless
references).
Also, I have been told that modules like Storable ( function freeze and
thaw) can be used for deep copying as well.
>$board = [[0,0,0,0],[0,1,-1,0],[0,-1,1,0],[0,0,0,0];
>computer_AI($board);
>
>sub computer_AI {
> local $board_AI = shift;
>
> # Do some stuff that alters $board_AI
>
>}
Ah. The "local" doesn't do a thing but temporarily saving the scalar
$board_AI. Nothing else. You're passing a pointer to a structure, and
$board_AI is just a different pointer to the same structure.
--
Bart.
------------------------------
Date: 26 Jun 2000 15:25:21 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Local & anonymous arrays
Message-Id: <slrn8lfciv.ka1.abigail@alexandra.delanet.com>
Christian (cdinchau@artsci.wustl.edu) wrote on MMCDXCI September MCMXCIII
in <URL:news:Pine.SOL.3.96.1000626125648.22980A-100000@ascc.artsci.wustl.edu>:
{} Hi,
{}
{} I was wondering how local and anonymous array references interact. I'm
{} writing an `othello-like' game anw want to pass $board to the compuer_AI
{} while protecting it from modification. Will local protect the original
{} $board, or must I do an explicit (element by element) copy?
It will protect what is *currently stored* in $board.
{} ## -- begin code snippit -- ##
{}
{} $board = [[0,0,0,0],[0,1,-1,0],[0,-1,1,0],[0,0,0,0];
{} computer_AI($board);
{}
{} sub computer_AI {
{} local $board_AI = shift;
This will protect what ever is in the package variable $board_AI. local()
will not do any kind of "protection" on the value on the RHS.
You want to use 'my $board_AI', and use Data::Dumper to make a copy.
Abigail
--
perl -e 'for (s??4a75737420616e6f74686572205065726c204861636b65720as?;??;??)
{s?(..)s\??qq \?print chr 0x$1 and q ss\??excess}'
------------------------------
Date: 26 Jun 2000 13:12:03 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Local & anonymous arrays
Message-Id: <m1k8fc9p7w.fsf@halfdome.holdit.com>
>>>>> "Bart" == Bart Lateur <bart.lateur@skynet.be> writes:
Bart> I think so. You need a "deep copy". See the code snippet from Randal
Bart> Schwartz' article at
Bart> <http://www.stonehenge.com/merlyn/UnixReview/col30.html>:
[thanks for the reference]
Bart> I think it would be worth it turning this code into a little module. The
Bart> only snag is that it doesn't work, as is, with objects (ak bless
Bart> references).
Right. Wasn't intended to. Storable::dclone will do that, probably
quicker than just about anything.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 26 Jun 2000 21:18:09 GMT
From: abaxaba <abaxaba@my-deja.com>
Subject: LWP suds
Message-Id: <8j8h9u$vov$1@nnrp1.deja.com>
I was wondering if anyone here had experience with SOAP [simple object
access protocol]. As near as I can tell -- it's a basic marriage
between XML and Http. As I am too lazy/ignorant to initiate raw socket
communication, and instead prefer to use our old friend LWP, I wondered
if their is a version of LWP::UserAgent or HTTP::Request that supports
Soap headers in the request. To wit:
~~~~~~
POST /StockQuote HTTP/1.1
Host: www.stockquoteserver.com
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "Some-URI"
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<SOAP-ENV:Header>
<t:Transaction
xmlns:t="some-URI"
SOAP-ENV:mustUnderstand="1">
5
</t:Transaction>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:GetLastTradePrice xmlns:m="Some-URI">
<symbol>DEF</symbol>
</m:GetLastTradePrice>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
As this is completely new to me, any help is greatly appreciated!
TIA---
msa
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 Jun 2000 14:43:51 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: LWP suds
Message-Id: <m18zvs86eg.fsf@halfdome.holdit.com>
>>>>> "abaxaba" == abaxaba <abaxaba@my-deja.com> writes:
abaxaba> I was wondering if anyone here had experience with SOAP
abaxaba> [simple object access protocol]. As near as I can tell --
abaxaba> it's a basic marriage between XML and Http. As I am too
abaxaba> lazy/ignorant to initiate raw socket communication, and
abaxaba> instead prefer to use our old friend LWP, I wondered if their
abaxaba> is a version of LWP::UserAgent or HTTP::Request that supports
abaxaba> Soap headers in the request.
Why not just use the SOAP modules?
search.cpan.org, type "SOAP" in the box on the left, hit return. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 26 Jun 2000 18:06:09 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: matching question (http related)
Message-Id: <8j862h$13s$5@ID-24002.news.cis.dfn.de>
hi,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Fix your headers. You forgot to do this
> when you switched personas. This is not
> news@tinita.de ya know.
look who's talking (again).
i've always posted as tina@streetmail.com with
reply-to news@tinita.de. as you
can see from the headers i'm on a linux machine.
i don't have an additional WinNT here...
and don't ignore my follow up again! this
is already offtopic...
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."
------------------------------
Date: Mon, 26 Jun 2000 12:47:15 -0700
From: "Gabe" <grichard@uci.edu>
Subject: Net::FTP export error?
Message-Id: <8j8c7f$ghh$1@news.service.uci.edu>
I'm trying to use Net::FTP on Win32. Here's the code:
#!c:/perl/bin
use Net::FTP
$ftp = Net::FTP->new("www.honors.uci.edu"); # This is line 6.
$ftp->login("$un","$pw");
$ftp->cwd("/sop");
$ftp->put("c:/temp/sopdbase.txt");
$ftp->quit;
Here's the error:
"Net::FTP=GLOB(0x8b1c440)" is not exported by the Net::FTP module at
sendso~1.pl line 6
Can't continue after import error at sendso~1.pl line 6
BEGIN failed--compilation aborted at sendso~1.pl line 6.
Can you help?
Gabe
------------------------------
Date: Mon, 26 Jun 2000 16:08:02 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Net::FTP export error?
Message-Id: <3957B822.F1AD7F66@attglobal.net>
Gabe wrote:
>
> I'm trying to use Net::FTP on Win32. Here's the code:
>
> #!c:/perl/bin
>
> use Net::FTP
^^^
Where is your semi-colon? Is this just a typo or did you forget?
Its always best to cut-n-paste code examples for this very reason.
> $ftp = Net::FTP->new("www.honors.uci.edu"); # This is line 6.
> $ftp->login("$un","$pw");
> $ftp->cwd("/sop");
> $ftp->put("c:/temp/sopdbase.txt");
> $ftp->quit;
>
------------------------------
Date: Mon, 26 Jun 2000 10:58:05 -0700
From: "Gabe" <grichard@uci.edu>
Subject: Net::FTP not on CPAN
Message-Id: <8j85qp$c0f$1@news.service.uci.edu>
Why isn't Net::FTP on CPAN? Where can I get it, or is there another module I
can use?
Gabe
------------------------------
Date: Mon, 26 Jun 2000 14:31:10 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Net::FTP not on CPAN
Message-Id: <3957A16E.7788FCD5@attglobal.net>
Gabe wrote:
>
> Why isn't Net::FTP on CPAN? Where can I get it, or is there another module I
> can use?
>
> Gabe
Net::FTP is part of the libnet bundle. You would have discovered
this on your own had you taken the time to go to the CPAN site and
type 'Net::FTP' in the search field.
------------------------------
Date: Mon, 26 Jun 2000 11:40:48 -0700
From: "Gabe" <grichard@uci.edu>
Subject: Re: Net::FTP not on CPAN
Message-Id: <8j88ar$dl6$1@news.service.uci.edu>
Drew Simonis <care227@attglobal.net> wrote in message
news:3957A16E.7788FCD5@attglobal.net...
> Gabe wrote:
> >
> > Why isn't Net::FTP on CPAN? Where can I get it, or is there another
module I
> > can use?
> >
> > Gabe
>
> Net::FTP is part of the libnet bundle. You would have discovered
> this on your own had you taken the time to go to the CPAN site and
> type 'Net::FTP' in the search field.
Actually, you're wrong.
I did take the time to go to the CPAN site, and I did type Net::FTP in the
search field and I still did not discover that Net::FTP is part of the
libnet bundle. In fact, I don't even know what "libnet bundle" is.
But now that you so nicely and patiently explained to me that Net::FTP is
part of the libnet bundle, I will return to CPAN and search again.
Thanks,
Gabe
You catch more flies with honey than vinegar.
------------------------------
Date: Mon, 26 Jun 2000 18:51:52 GMT
From: nfin8axs@hotmail.com
Subject: Re: Net::FTP not on CPAN
Message-Id: <8j88o1$oju$1@nnrp1.deja.com>
> Why isn't Net::FTP on CPAN? Where can I get it, or is there another
>module I
> can use?
It should be there, I recommend getting the Perl In a Nutshell O'reilly
book, if you dont already have it.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 Jun 2000 14:05:19 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Net::FTP not on CPAN
Message-Id: <87k8fcb6vk.fsf@limey.hpcc.uh.edu>
>> On Mon, 26 Jun 2000 10:58:05 -0700,
>> "Gabe" <grichard@uci.edu> said:
> Why isn't Net::FTP on CPAN? Where can I get it, or is
> there another module I can use?
Ah, but it is.
worked for me.
# perl -MCPAN -eshell
cpan> i /Net::FTP/
...
cpan> install Net::FTP
...
cpan> quit
#
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: 26 Jun 2000 15:25:53 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Net::FTP not on CPAN
Message-Id: <slrn8lfcjv.ka1.abigail@alexandra.delanet.com>
Gabe (grichard@uci.edu) wrote on MMCDXCI September MCMXCIII in
<URL:news:8j85qp$c0f$1@news.service.uci.edu>:
.. Why isn't Net::FTP on CPAN?
But it is.
Abigail
--
split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
------------------------------
Date: Mon, 26 Jun 2000 18:20:48 GMT
From: David Ness <DNess@Home.Com>
Subject: Re: Newbie question about subroutines...
Message-Id: <39579F04.CC89FB7A@Home.Com>
Vlasis Hatzistavrou wrote:
>
> Hi,
>
> The metaengine does not concer any of the public search enginees around. It's about
> creating a common basic search tool for various e-journal providers who already
> provide us with their search tools. Permission is already obtained.
>
> Thanks again,
>
> --
> Vlasis Hatzistavrou
You should perhaps notice that _most_ of what determines the behavior of
the apparently `simultaneous' execution of several threads has to do with
hardware and operating system rather than programming language. Lots of
environments that appear to allow simultaneous execution really execute
things in sequence.
For most simple processor/system environments little is gained by attempting
simultaneous execution, the processor is actually only executing one thing
at one time, and unless there are `blocks' in the process when otherwise
nothing would be done, little profit can accrue.
So don't expect much `magic' unless your underlying problem has long blocks
during which no computation can be done, or unless you have hardware that
supports simultaneous execution of several threads. As we say `You can't
get blood out of a stone...' and a single processor architecture can really
only effectively do one particular thing at any given instant...
------------------------------
Date: Mon, 26 Jun 2000 19:05:21 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Newbie question about subroutines...
Message-Id: <3958a61b.10270700@news.skynet.be>
David Ness wrote:
>For most simple processor/system environments little is gained by attempting
>simultaneous execution, the processor is actually only executing one thing
>at one time, and unless there are `blocks' in the process when otherwise
>nothing would be done, little profit can accrue.
I think this is an exception, where most of the threads would be
waiting, expecting input from the outside world.
If the *connection* to the outside world is the bottleneck, then again
there wouln't be much gain.
--
Bart.
------------------------------
Date: Mon, 26 Jun 2000 20:00:30 GMT
From: David Ness <DNess@Home.Com>
Subject: Re: Newbie question about subroutines...
Message-Id: <3957B662.14405914@Home.Com>
Bart Lateur wrote:
>
> David Ness wrote:
>
> >For most simple processor/system environments little is gained by attempting
> >simultaneous execution, the processor is actually only executing one thing
> >at one time, and unless there are `blocks' in the process when otherwise
> >nothing would be done, little profit can accrue.
>
> I think this is an exception, where most of the threads would be
> waiting, expecting input from the outside world.
>
That's one example of what a `block' is. If there are `blocks' then, as I
said, profit may accrue if you can overlap them (but it probably doesn't
require any elaborate threading to do that---witness print servers on
otherwise single thread DOS machines).
>
> If the *connection* to the outside world is the bottleneck, then again
> there wouln't be much gain.
>
I'm not quite sure what you mean by `connection to the outside world' being
the bottleneck, so I can't comment on this part.
------------------------------
Date: Mon, 26 Jun 2000 20:59:11 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Newbie question about subroutines...
Message-Id: <395dbdbc.16319700@news.skynet.be>
David Ness wrote:
>> If the *connection* to the outside world is the bottleneck, then again
>> there wouln't be much gain.
>>
>
>I'm not quite sure what you mean by `connection to the outside world' being
>the bottleneck, so I can't comment on this part.
The guy said he wanted to query several Internet search engines at once.
If the bottleneck is your connection to the internet, then you're stuck
with it.
If, however, either the servers are slow to reply, or the routing from
them to your machine takes a long time, then they are the bottlneck, and
speed gain by doing threading is possible.
--
Bart.
------------------------------
Date: Sat, 24 Jun 2000 15:07:56 GMT
From: Larry R. Waibel <lwaibel@cwia.com>
Subject: Re: NT or Unix at runtime
Message-Id: <VA.0000003B.1E2632B4@CWIA.COM>
In article <8isngh$ofq$1@bcrkh13.ca.nortel.com>, Brandon Metcalf wrote:
> > But that would mean that all the client users would have to install Perl as
> > well and ClearCase. Using what comes with it means the triggers will work
> > since it's already installed.
>
> Err... nfs, nt shares...
>
Even those mean something else that has to be setup on the client (at least a
drive mapping involve a drive letter that, no matter which we choose someone may
be using for something else). A few individual setups may not be a problem;
hundreds or thousands sure would <sigh>.
------------------------------
Date: 26 Jun 2000 14:58:53 EDT
From: Chris Sorensen <csorensen@uptimeresources.net>
Subject: Re: Number of Unique Values
Message-Id: <3957A7DD.B92D5201@uptimeresources.net>
If the list is an array. Print the array in a scalar context. That will
return the size of the array rather than it's contents.
if it's a hash .. use the keys function.
Colby Hansen wrote:
>
> I'm wondering what the easiest way is to find the number of unique values in
> a list. Also, is there a way to do it using PDL? Thanks!
------------------------------
Date: 26 Jun 2000 19:31:27 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: Number of Unique Values
Message-Id: <8j8b2f$r9h$1@internal-news.uu.net>
Colby Hansen <cghansen@micron.com> wrote:
> I'm wondering what the easiest way is to find the number of unique values in
> a list. Also, is there a way to do it using PDL? Thanks!
This should get you started:
perlfaq4:
How can I extract just the unique elements of an array?
Erik
------------------------------
Date: 26 Jun 2000 16:03:13 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Number of Unique Values
Message-Id: <slrn8lfepv.ka1.abigail@alexandra.delanet.com>
Colby Hansen (cghansen@micron.com) wrote on MMCDXCI September MCMXCIII in
<URL:news:8j82bg$fck$1@admin-srv3.micron.com>:
{} I'm wondering what the easiest way is to find the number of unique values in
{} a list.
my $nr_of_unique = keys %{{map {$_ => 1} @list}};
Abigail
--
perl -Mstrict -we '$_ = "goto K.print chop;\n=rekcaH lreP rehtona tsuJ";K1:eval'
------------------------------
Date: 26 Jun 2000 16:05:07 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Number of Unique Values
Message-Id: <slrn8lfeth.ka1.abigail@alexandra.delanet.com>
Chris Sorensen (csorensen@uptimeresources.net) wrote on MMCDXCI September
MCMXCIII in <URL:news:3957A7DD.B92D5201@uptimeresources.net>:
De-Jeopardize:
\\ Colby Hansen wrote:
\\ >
\\ > I'm wondering what the easiest way is to find the number of unique values i
\\ > a list. Also, is there a way to do it using PDL? Thanks!
\\ If the list is an array. Print the array in a scalar context. That will
\\ return the size of the array rather than it's contents.
But that doesn't give you the number of *unique* values.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: Mon, 26 Jun 2000 19:59:10 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Number of Unique Values
Message-Id: <8j8cm2$rvg$1@nnrp1.deja.com>
In article <8j82bg$fck$1@admin-srv3.micron.com>,
"Colby Hansen" <cghansen@micron.com> wrote:
> I'm wondering what the easiest way is to find the number of unique
values in
> a list. Also, is there a way to do it using PDL? Thanks!
>
Sounds like a FAQ:
"How can I extract just the unique elements of an array?"
The answer may be found in your local 'perldoc perlfaq4'
or at http://www.cpan.org/doc/manual/html/pod/perlfaq4.html.
Hope this helps.
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 26 Jun 2000 13:13:27 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Number of Unique Values
Message-Id: <8j8dgv$hvh$1@brokaw.wa.com>
Colby Hansen <cghansen@micron.com> wrote in message
news:8j82bg$fck$1@admin-srv3.micron.com...
> I'm wondering what the easiest way is to find the number of unique values
in
> a list.
'perldoc -q unique' yields:
perlfaq4: How can I extract just the unique elements of an array?
Also try
perldoc perldata
> Also, is there a way to do it using PDL? Thanks!
I have no idea what PDL is.
Lauren
------------------------------
Date: Mon, 26 Jun 2000 19:37:26 GMT
From: mike@excite.com ()
Subject: perl 5.6: bug with -0777 slurping?
Message-Id: <slrn8lfcs9.73o.mike@zorak.happyfish.org>
I've run into some recent problems when upgrading from perl 5.004_05
to 5.6.0. Here is the first one:
The "-0777n" command-line option to perl causes duplicate execution.
I seem to get an extra iteration of the while (<>) loop. Also, the
same thing happens if the effect of "-0777n" is, instead, implemented
within the perl script. Here are some examples that compare results
from perl version 5.00405 and perl version 5.6.0:
Example A
---------
/bin/echo "abc" | perl -0777ne ' print "111 $_ 222\n"'
5.00405
=======> 111 abc
222
5.6.0
=======> 111 abc
222
111 222
Why is <> returning an empty string instead of an undef the second
time through the loop? Why is the empty string treated as true by the
while loop?
Example B
---------
/bin/echo "abc" \
| perl -e 'undef $/; while (<>) {print "111 $_ 222\n"}'
5.00405
=======> 111 abc
222
5.6.0
=======> 111 abc
222
111 222
Example C (The problem does NOT occur in this case)
---------
/bin/echo "abc" \
| perl -e 'undef $/; $_ = <>; print "111 $_ 222\n"'
=======> 111 abc
222
That's because I am just reading from <> once.
Any help would be greatly appreciated.
Mike
mikemulvaney@excite.com
------------------------------
Date: Mon, 26 Jun 2000 13:57:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl 5.6: bug with -0777 slurping?
Message-Id: <Pine.GSO.4.10.10006261356510.23149-100000@user2.teleport.com>
On Mon, 26 Jun 2000 mike@excite.com wrote:
> Why is <> returning an empty string instead of an undef the second
> time through the loop? Why is the empty string treated as true by the
> while loop?
Smells like a bug. Use perlbug to report this. Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 26 Jun 2000 21:25:47 GMT
From: malverian@hotmail.com
Subject: Perl Chat Program Help
Message-Id: <8j8ho5$6u$1@nnrp1.deja.com>
I have created the following program in Perl... It is a chat program.
Currently when it connects it sends
"User " . $new->fileno . " Enters."
to the whole chat.
And sets a variable called $lastname to $new->fileno
When someone sends something, it will do $lastname: <whattheysent>
to everyone on the screen.
This is no good since everyone will have the same Name in the chat...
This is one thing I would like help with.. put in another way.. Is
there some kind of back use for fileno?
So I can tell what person is sending the data?
If this is hard to understand please ask..
Here is the script
_____________________________________________
use IO::Socket;
use IO::Select;
my $listen = IO::Socket::INET->new(Proto => 'tcp', LocalPort => 9000,
Listen => 1, Reuse => 1) or die $!;
my $select = IO::Select->new($listen);
my @ready;
while(@ready = $select->can_read)
{
my $socket;
for $socket (@ready)
{
if($socket == $listen)
{
my $new = $listen->accept;
$select->add($new);
my $socket;
for $socket ($select->handles)
{
next if($socket==$listen);
$socket->send("User " . $new-
>fileno . " Enters.\n");
$lastuser = $new->fileno;
}
}
else
{
my $line="";
$socket->recv($line,80);
if($line eq "")
{
};
my $socket;
for $socket ($select->handles)
{
next if($socket==$listen);
if ($line =~ /^\#nick .+/i)
{
$lastuser = substr($line,5,-1);
}
elsif ($line =~ /^:.+/i)
{
$line = substr($line,1);
$socket->send("$lastuser $line");
}
else
{
$socket->send("$lastuser: $line");
}
}
}
}
}
1;
____________________________________________________
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 25 Jun 2000 22:05:22 +0200
From: "D De Villiers" <ddevilliers@lando.co.za>
Subject: Perl for Palm ?
Message-Id: <8j8fvv$3lq$1@ctb-nnrp2.saix.net>
Hello, Everyone
I just started programming my Palm device and is looking for a version of
Perl for the Palm. Does anyone know please know if such a product exist and
where I can find it ?
Lennie De Villiers
ICQ# 57008830
E-mail: ddevilliers@lando.co.za
Moderator: news:comp.sources.delphi
Lennie's Weekly Delphi Tips:
----------------------------
http://ssapcs.hispeed.com/Lennie/LennieTips.htm
Lennie's Delphi Mailinglist:
----------------------------
To subscribe, send a e-mail to ddevilliers_delphi-subscribe@egroups.com or
visit http://www.egroups.com/group/ddevilliers_delphi/ for more information.
Dr.Bob's Kylix Kicks:
---------------------
http://www.drbob42.com/kylix/
The Delphi Shrine:
------------------
http://www.delphishrine.com/
A new Delphi website by my friend Emiel Hollander. Tips & Taticks,
Tutorials, FAQs, and much more...
------------------------------
Date: Mon, 26 Jun 2000 14:09:10 -0700
From: Aaron <alager@csuchico.edu>
Subject: Perl/Tk--help with binding an even
Message-Id: <3957C676.E490E317@csuchico.edu>
The default actions for a button only respond to a button click or the
space bar. I want to add the Return key to do whatever the default
action is *without* having to recode the default action.
my $login_dialog_ok_but = $login_dialog->Button(
-text => 'Ok',
-command => sub {
print "foo";
});
$login_dialog_ok_but->bind("<Return>", sub { print "foo" });
Is there a way to bind the Return key to be the same a button-1 without
having to duplicate the code?
Thanks for you help.
Aaron
------------------------------
Date: Mon, 26 Jun 2000 21:18:23 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Perl/Tk--help with binding an even
Message-Id: <7an1k8dtun.fsf@merlin.hyperchip.com>
Aaron <alager@csuchico.edu> writes:
> $login_dialog_ok_but->bind("<Return>", sub { print "foo" });
>
> Is there a way to bind the Return key to be the same a button-1 without
> having to duplicate the code?
You mean:
$button->bind('<Return>' => sub { $button->invoke });
??
--Ala
------------------------------
Date: Mon, 26 Jun 2000 14:32:14 -0700
From: Aaron <alager@csuchico.edu>
Subject: Re: Perl/Tk--help with binding an even
Message-Id: <3957CBDE.7C2D645E@csuchico.edu>
Ala Qumsieh wrote:
> Aaron <alager@csuchico.edu> writes:
>
> > $login_dialog_ok_but->bind("<Return>", sub { print "foo" });
> >
> > Is there a way to bind the Return key to be the same a button-1 without
> > having to duplicate the code?
>
> You mean:
>
> $button->bind('<Return>' => sub { $button->invoke });
>
> ??
>
> --Ala
Thank you very much! That was it. I never saw that in the book before,
probably because they dedicated a whole 3 lines to it, and not in the
bindings section. Well back to work. Thanks again.
Aaron
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3484
**************************************