[27172] in Perl-Users-Digest
Perl-Users Digest, Issue: 9001 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 28 03:05:39 2006
Date: Tue, 28 Feb 2006 00:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 28 Feb 2006 Volume: 10 Number: 9001
Today's topics:
Re: A Problem With GD <matthew.garrish@sympatico.ca>
Re: A Problem With GD <1usa@llenroc.ude.invalid>
Re: A Problem With GD <samwyse@gmail.com>
Copy contents of reference <ppi@searchy.net>
Re: Copy contents of reference <jgibson@mail.arc.nasa.gov>
Re: Copy contents of reference lawrence@hummer.not-here.net
Re: Import other perl files <kkeller-usenet@wombat.san-francisco.ca.us>
Re: Import other perl files <1usa@llenroc.ude.invalid>
Re: Import other perl files <josef.moellers@fujitsu-siemens.com>
Re: References as Hash Keys, Tree Structures (Newbie) ( xhoster@gmail.com
Re: References as Hash Keys, Tree Structures (Newbie) <uri@stemsystems.com>
Re: References as Hash Keys, Tree Structures (Newbie) <tassilo.von.parseval@rwth-aachen.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 27 Feb 2006 17:55:38 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: A Problem With GD
Message-Id: <DsLMf.2889$972.81921@news20.bellglobal.com>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns977799A442F21asu1cornelledu@127.0.0.1...
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
> news:Xns9777987F99118asu1cornelledu@127.0.0.1:
>
>> Ch Lambert,
>
> Apologies, Christoph, for butchering your name. I, of course, had meant to
> write 'Lamprecht'.
>
Watching Highlander while typing? : )
Matt
------------------------------
Date: Mon, 27 Feb 2006 23:18:33 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: A Problem With GD
Message-Id: <Xns9777BA5A19BF6asu1cornelledu@127.0.0.1>
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in
news:DsLMf.2889$972.81921@news20.bellglobal.com:
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns977799A442F21asu1cornelledu@127.0.0.1...
>> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
>> news:Xns9777987F99118asu1cornelledu@127.0.0.1:
>>
>>> Ch Lambert,
>>
>> Apologies, Christoph, for butchering your name. I, of course, had
>> meant to write 'Lamprecht'.
>>
>
> Watching Highlander while typing? : )
That must be it!
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Tue, 28 Feb 2006 05:12:17 GMT
From: Samwyse <samwyse@gmail.com>
Subject: Re: A Problem With GD
Message-Id: <RYQMf.16236$rL5.12237@newssvr27.news.prodigy.net>
Mark Manning wrote:
> Yes I do and like others - you are assuming things that are incorrect.
Why are you top-posting? I found this massive thread, but I'm unable to
figure out what you're talking about. Although it seems that you're
trying to post a bug report about GD. Why do you think that anyone on
this group can help with that? Doesn't GD have a place to send such
reports?
------------------------------
Date: Tue, 28 Feb 2006 01:27:03 +0100
From: Frank <ppi@searchy.net>
Subject: Copy contents of reference
Message-Id: <44039944$0$11080$e4fe514c@news.xs4all.nl>
Hi,
Is it possible to copy the contents of a scalar/hash/array-reference to
a scalar/hash/array variable?
I have this script:
use Data::Dumper;
my $save_ref;
my @save_arr;
my @array = ("one","two","three");
$save_ref = \@array;
@save_arr = $save_ref;
print Dumper(@save_arr);
@array = ();
print Dumper(@save_arr);
And the end I want @save_arr to be 'disconnected' from anything leading
back to the original @array.
Regards,
Frank
------------------------------
Date: Mon, 27 Feb 2006 16:49:46 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Copy contents of reference
Message-Id: <270220061649464509%jgibson@mail.arc.nasa.gov>
In article <44039944$0$11080$e4fe514c@news.xs4all.nl>, Frank
<ppi@searchy.net> wrote:
> Hi,
>
> Is it possible to copy the contents of a scalar/hash/array-reference to
> a scalar/hash/array variable?
Yes.
>
> I have this script:
>
> use Data::Dumper;
> my $save_ref;
> my @save_arr;
> my @array = ("one","two","three");
>
> $save_ref = \@array;
> @save_arr = $save_ref;
@save_arr = @{$save_ref};
> print Dumper(@save_arr);
print Dumper(\@save_arr); # looks a little better
>
> @array = ();
>
> print Dumper(@save_arr);
ditto.
>
>
> And the end I want @save_arr to be 'disconnected' from anything leading
> back to the original @array.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: 27 Feb 2006 17:02:36 -0800
From: lawrence@hummer.not-here.net
Subject: Re: Copy contents of reference
Message-Id: <87irr0qor7.fsf@hummer.i-did-not-set--mail-host-address--so-shoot-me>
Frank <ppi@searchy.net> writes:
> Hi,
>
> Is it possible to copy the contents of a scalar/hash/array-reference
> to a scalar/hash/array variable?
>
Yes
The way I typically use to get a copy of an arrayref:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my @array = qw / one two three /;
my $array_R = \@array;
my $save_R = [ @$array_R ] ;
@array = ();
print Dumper $array_R, $save_R;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
------------------------------
Date: Mon, 27 Feb 2006 19:26:07 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Import other perl files
Message-Id: <gfscd3xdks.ln2@goaway.wombat.san-francisco.ca.us>
On 2006-02-27, A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
>
> perldoc use
Do you mean perldoc -f use ?
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information
------------------------------
Date: Tue, 28 Feb 2006 03:51:34 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Import other perl files
Message-Id: <Xns9777E89497452asu1cornelledu@127.0.0.1>
Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote in
news:gfscd3xdks.ln2@goaway.wombat.san-francisco.ca.us:
> On 2006-02-27, A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
>>
>> perldoc use
>
> Do you mean perldoc -f use ?
Of course. Thanks for catching that.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Tue, 28 Feb 2006 09:01:40 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Import other perl files
Message-Id: <du1052$9dt$2@nntp.fujitsu-siemens.com>
Robin Wilson wrote:
> I have a perl file which I would like to divide up into 2 perl files so=
that=20
> the content is seperate
>=20
> I created 2 files and then moves some variables into the other file but=
I=20
> cannot work out how to include the second file
>=20
> I thought the syntax was:
>=20
> USE FILE.PL
>=20
> but that's not working
Do not use USE, use use ;-)
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 28 Feb 2006 00:39:53 GMT
From: xhoster@gmail.com
Subject: Re: References as Hash Keys, Tree Structures (Newbie) (Was: simple pointer operations (newbe))
Message-Id: <20060227194321.652$9D@newsreader.com>
"Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi> wrote:
>
> Which reminds me, why do most programming languages including Perl stop
> to vectors and hashes as far as the fancy out-of-the-box data structures
> go?
I think Java has ordered maps or something like that in the standard
libraries.
> Why not extend this to, say, B plus trees, among others, as people
> willl have to code them sooner or later.
The B+ tree is pretty much designed for disk-based access (although I
imagine you might get some benefit from the L1,L2 caches even for in-memory
implementations), which I think would make it a pretty unusual choice
for a primitive.
Aside from which, I've never felt the need to code them sooner or later.
Install Mysql, install DBI, bam--you have most of the indexing capabilities
you will need. I guess you don't have scrollable cursors.
> Yep, I know there are B-trees
> for Perl, I just read an excellent tutorial on one.
Which one?
> But it would be nice
> to have efficient, balanced tree structures available by default as
> modules, especially as they aren't that trivial to implement well.
They also aren't trivial to implement generically. What page size do you
use? What ordering function do you use? Unique or non-unique? How do you
munge the language's syntax to allow range queries as a primitive?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 27 Feb 2006 23:49:10 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: References as Hash Keys, Tree Structures (Newbie)
Message-Id: <x7mzgc3x6h.fsf@mail.sysarch.com>
>>>>> "TvP" == Tassilo v Parseval <tassilo.von.parseval@rwth-aachen.de> writes:
TvP> Also sprach Veli-Pekka Tätilä:
>> Umm yes, the equals method in the Java example applies to the
>> object to be hashed but the hash code returned by that object is
>> used as the index. Which naturally leads to the question, what are
>> hashed objects as keys good for if anything? So far I haven't been
>> able to think of any real good uses.
TvP> Nowadays they are commonly used for the implementation of
TvP> inside-out objects. Whenever you want to associate some
TvP> additional data with an object, the ability to use it as hash-key
TvP> is useful.
i use refs as hash keys in several places. one is to track a set of refs
where you want to be able to add/delete them. these are usually objects
but there is no reason they couldn't be regular refs. an example is an
event loop where you need to track live events and be able to find them
all. a hash of those objects as key and value is perfect for that.
so just because someone can't see a good reason to use a certain idiom
doesn't mean they don't exist.
and i wouldn't call them hashed objects. a hash of objects (or refs) is
probably clearer and definitely more accurate.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Mon, 27 Feb 2006 09:37:39 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: References as Hash Keys, Tree Structures (Newbie)
Message-Id: <46icu7FbatadU1@news.dfncis.de>
Also sprach Uri Guttman:
>>>>>> "TvP" == Tassilo v Parseval <tassilo.von.parseval@rwth-aachen.de> writes:
>
> TvP> Also sprach Veli-Pekka Tätilä:
>
> >> Umm yes, the equals method in the Java example applies to the
> >> object to be hashed but the hash code returned by that object is
> >> used as the index. Which naturally leads to the question, what are
> >> hashed objects as keys good for if anything? So far I haven't been
> >> able to think of any real good uses.
>
> TvP> Nowadays they are commonly used for the implementation of
> TvP> inside-out objects. Whenever you want to associate some
> TvP> additional data with an object, the ability to use it as hash-key
> TvP> is useful.
>
> i use refs as hash keys in several places. one is to track a set of refs
> where you want to be able to add/delete them. these are usually objects
> but there is no reason they couldn't be regular refs. an example is an
> event loop where you need to track live events and be able to find them
> all. a hash of those objects as key and value is perfect for that.
Interesting that you mention this scenario because this usage (keeping
track of events and associated objects) was the very one I came across
just recently. They used it for debugging purpose to see if any objects
leaked which can be a pain to figure out in event-based programming.
They used a weakened hash lest they interfere with the garbage
collecting.
> so just because someone can't see a good reason to use a certain idiom
> doesn't mean they don't exist.
Certainly not. :-)
> and i wouldn't call them hashed objects. a hash of objects (or refs) is
> probably clearer and definitely more accurate.
It's both ambiguous as 'hash' can mean the data-type (in Perl at least)
or it can mean the return value of the hashing function applied to the
object. I think we're both referring to the latter.
Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9001
***************************************