[27183] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9007 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 1 06:05:43 2006

Date: Wed, 1 Mar 2006 03: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           Wed, 1 Mar 2006     Volume: 10 Number: 9007

Today's topics:
    Re: Keith Keller - Coward currys favour <josef.moellers@fujitsu-siemens.com>
    Re: Keith Keller - Coward currys favour <rr@rrrrrr.org>
        Ordered hashes <january.weiner@gmail.com>
    Re: Ordered hashes <christoph.lamprecht.no.spam@web.de>
    Re: Perl 5.8.x, Unicode and In-memory Filehandles <cbkihong@hotmail.com>
    Re: simple pointer operations (newbe) <uri@stemsystems.com>
    Re: Weighing the evidence, Perl is a GUESSING game !! <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 01 Mar 2006 08:44:17 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Keith Keller - Coward currys favour
Message-Id: <du3jg7$bp4$1@nntp.fujitsu-siemens.com>

rrrrrr rrrrrrrr wrote:
> Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> trolled:
>=20
> [coward's words deleted]
>=20
> Keith Keller hides his PGP in this group to curry favour with people
> he wishes to impress.  In alt.os.linux.slackware he advocates using
> PGP because he wishes to curry favour with people in that group he
> wishes to impress.
>=20
> Keith Keller is a coward fit for killfiles.

For one, Keith Keller uses a real name.
So: who's a coward?

--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: Wed, 01 Mar 2006 09:18:32 GMT
From: rrrrrr rrrrrrrr <rr@rrrrrr.org>
Subject: Re: Keith Keller - Coward currys favour
Message-Id: <IFdNf.3365$RM2.375344@news20.bellglobal.com>

Josef Moellers <josef.moellers@fujitsu-siemens.com> trolled:
> rrrrrr rrrrrrrr wrote:
> > Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> trolled:
> > 
> > [coward's words deleted]
> > 
> > Keith Keller hides his PGP in this group to curry favour with
> > people he wishes to impress.  In alt.os.linux.slackware he
> > advocates using PGP because he wishes to curry favour with
> > people in that group he wishes to impress.
> > 
> > Keith Keller is a coward fit for killfiles.

> For one, Keith Keller uses a real name.

It may be a real name.  But it's not his name.

Keith Keller is a coward and a hypocrite who currys favour.


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

Date: Wed, 1 Mar 2006 08:49:49 +0100 (CET)
From: January Weiner <january.weiner@gmail.com>
Subject: Ordered hashes
Message-Id: <du3jmt$7df$1@sagnix.uni-muenster.de>

Hi,

I run into this basic problem now and then. 

Hashes allow you to access an element by a key.  However, hashes are not
ordered.  Take the following example: I have a hash containing a menu
structure:

  my %menu = ( -file => [ "new", "open", "save" ], 
               -analize => [ "count", "add", "subtract" ],
               -help => [ "yelp", "cry", "bang your head on the wall" ],
              ) ;

Now I have some arbitrary function that should display this menu.  However,
the order should be preserved, and there is no way we could order it
automatically (e.g. alphabetically).  I see two solutions:

1) create a menu index:

  my @menu_idx = ( "-file", "-analize", "-help" ) ;

  for(@menu_idx) {
    do_something($menu{$_}) ;
  }

2) pretend %menu is an array:

  my @menu = ( "-file", [ "new", "open", "save" ], 
               "-analize", [ "count", "add", "subtract" ],
               "-help", [ "yelp", "cry", "bang your head on the wall" ],
              ) ;

  my %menu_hash = @menu ;

  for($i = 0 ; $i < scalar(@menu) ; $i += 2) {
    do_something($menu_hash{$menu[$i]}) ;
  }

Neither seems to be satisfactory.  Are there better ways of dealing with
this problem?

j.

-- 


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

Date: Wed, 01 Mar 2006 10:25:47 +0100
From: Ch Lamprecht <christoph.lamprecht.no.spam@web.de>
Subject: Re: Ordered hashes
Message-Id: <du3par$fh3$1@online.de>

January Weiner wrote:
> Hi,
> 
> I run into this basic problem now and then. 
> 
> Hashes allow you to access an element by a key.  However, hashes are not
> ordered.  Take the following example: I have a hash containing a menu
> structure:
> 
>   my %menu = ( -file => [ "new", "open", "save" ], 
>                -analize => [ "count", "add", "subtract" ],
>                -help => [ "yelp", "cry", "bang your head on the wall" ],
>               ) ;
> 
> Now I have some arbitrary function that should display this menu.  However,
> the order should be preserved, and there is no way we could order it
> automatically (e.g. alphabetically).  I see two solutions:
> 

> 
> Neither seems to be satisfactory.  Are there better ways of dealing with
> this problem?
> 
> j.
> 
Hi,
perldoc -q order hash

HTH, Chris


-- 

perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"


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

Date: Wed, 01 Mar 2006 16:00:22 +0800
From: Bernard Chan <cbkihong@hotmail.com>
Subject: Re: Perl 5.8.x, Unicode and In-memory Filehandles
Message-Id: <440556a6$0$7112$6d36acad@titian.nntpserver.com>


I am inclined to think this may be related to the in-memory nature of
the filehandle. In the latest revision of the test script I have tried this:

================================================
#!/usr/bin/perl -w

BEGIN {
	require "require.pl";
}

my ($io_sys, $BUF);
open $io_sys, ">&", \*STDOUT; close STDOUT;
open STDOUT, ">:utf8", \$BUF;

open FILE, "<:encoding(utf8)", "utf8_1.txt";
@lines = <FILE>;
close FILE;

my $buffered_content2 = (join("<br>\n", @lines));  # (1)
print (join("<br>\n", @lines));	

my $buffered_content = $BUF;
$BUF = '';
seek STDOUT, 0, 0;

binmode($io_sys, ":encoding(big5)");
print $io_sys $buffered_content2;  # (2)
================================================

Basically the modifications are labelled as (1) and (2). Line (1) is the
actual added line. In this program, when I try to print
$buffered_content on line (2) as before, the same output as previously
quoted was seen. However, when I change line (2) to $buffered_content2,
the output is exactly what I wanted (Big5). So it seems like there are
differences because the expression resulted from join() in both cases
were identical. The only difference was that one was read from the
variable representing the in-memory buffer, while the other directly as
generated from the join().

I checked that bytewise the two strings are byte-to-byte identical, and
that after using utf8::upgrade($buffer_content) both strings are valid
UTF-8 with the UTF-8 flag set, but "eq" the two strings still returns
false. I think there should be some intricate stuff in there.

Anyone may explain why this is so? Thank you in advance.

Regards,
Bernard Chan.

*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***


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

Date: Wed, 01 Mar 2006 00:06:14 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: simple pointer operations (newbe)
Message-Id: <x74q2iwy7t.fsf@mail.sysarch.com>

>>>>> "r" == robic0  <robic0> writes:

  r> On 25 Feb 2006 16:24:27 GMT, Abigail <abigail@abigail.nl> wrote:

  >> Once again, Perl has references. Not pointers. And while the
  >> stringification of a reference of an array contains a memory address,

  r> A memory address, really? A physical memory address, or a virtual
  r> address within the process space?

the point to the large space in your skull.

  >> and that memory address is indeed the address of the array,

  r> Really? How would you know that? Is it something percolated up from
  r> the Perl C core?

he looked at the source? he has a brain (unlike you)?

  >> address of the first element.

  r> How can an address be known in Perl script? A literal number
  r> isin't an address!

you need to learn much more about perl before you can stop blathering
like that.

  >> It's the address of a struct (the array)

  r> No it isin't. If its a number, its an index.

i think abigail knows a trifle amount more about perl than you. ok, a
lot more than a trifle.

  >> of which one element points to an array of pointers of structures
  >> containing scalars.
  >> 
  >> Perl is not C.

  r> Right! Perl isin't C! If you program in C you may be used to thinking
  r> in terms of addresses and contents. Just make sure you know what forum
  r> your in. 

just make sure you know which of your schizo personalities is
controlling you at the moment.

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: Wed, 01 Mar 2006 00:10:04 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Weighing the evidence, Perl is a GUESSING game !!
Message-Id: <x7veuyvjgz.fsf@mail.sysarch.com>

>>>>> "r" == robic0  <robic0> writes:

  r> I'm ready to go to the mat on this one ...

i'd like to introduce you to moronzilla one day. the two of you would
make a very happy and loonie couple and you could go off inventing your
own languages.

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: 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 9007
***************************************


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