[26366] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8538 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 18 18:05:38 2005

Date: Tue, 18 Oct 2005 15:05: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           Tue, 18 Oct 2005     Volume: 10 Number: 8538

Today's topics:
    Re: Case Sensitive Regex <noreply@gunnar.cc>
    Re: FAQ 4.69 How can I use a reference as a hash key? <jgibson@mail.arc.nasa.gov>
    Re: Microsoft Hatred FAQ <mscottschilling@hotmail.com>
    Re: Perl Script Question - Working with Directories <rvtol+news@isolution.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 18 Oct 2005 21:27:29 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Case Sensitive Regex
Message-Id: <3rl0h9Fk329eU1@individual.net>

John Bokma wrote:
> Gunnar Hjalmarsson wrote:
>>John Bokma wrote:
>>>Much better is to define what exactly is allowed v.s. to think up bad 
>>>cases, and check for those.
>>
>>Sometimes that's better.
>>
>>As regards a name field: Don't think so.
> 
> I think it's not that hard to come up with a nice definition of what is 
> allowed in a name, even when unicode is allowed. It's a bit harder if 
> handles/nicks, etc are allowed, since then stuff like 733+h@><0r could be a 
> "name", but even then :-)

Even if it would be _possible_, how on earth could it be _better_ if the 
purpose is to prevent abusers from adding extra mail headers?

See http://groups.google.com/group/comp.lang.perl.misc/msg/02a2892e2f4705ef

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Tue, 18 Oct 2005 12:51:22 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: FAQ 4.69 How can I use a reference as a hash key?
Message-Id: <181020051251228065%jgibson@mail.arc.nasa.gov>

In article <dj2e5t$49t$1@mamenchi.zrz.TU-Berlin.DE>, Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de> wrote:

> Jim Gibson  <jgibson@mail.arc.nasa.gov> wrote in comp.lang.perl.misc:
> > In article <091020051535518794%comdog@panix.com>, brian d foy
> > <comdog@panix.com> wrote:
> > 
> > > In article <190920051034314514%jgibson@mail.arc.nasa.gov>, Jim Gibson
> > > <jgibson@mail.arc.nasa.gov> wrote:
> > > 
> > > > In article <dgm2cl$cgt$1@reader1.panix.com>, PerlFAQ Server
> > > > <comdog@panix.com> wrote:
> > > > 
> > > > > This message is one of several periodic postings to
> > > > > comp.lang.perl.misc
> > > > > intended to make it easier for perl programmers to find answers to
> > > > > common questions. The core of this message represents an excerpt
> > > > > from the documentation provided with Perl.
> > > > > 
> > > > > --------------------------------------------------------------------
> > > > > 
> > > > > 4.69: How can I use a reference as a hash key?
> > > > > 
> > > > >     You can't do this directly, but you could use the standard
> > > > >     Tie::RefHash
> > > > >     module distributed with Perl.
> > > > 
> > > > This answer seems incomplete and therefore misleading. You can use hard
> > > > references as hash keys, because they become stringified and are
> > > > unique. 
> 
> A hash key is a string, a reference is not.  You can't use a reference
> as a hash key.

A binary number isn't a string, either, but must be stringified before
being used as a hash key. What's the difference, other than the fact
that you can retrieve the number string from the hash and convert it
back to a number, but you can't retrieve the reference string and
convert it back to a reference?

> 
> You can use a reference to generate a hash key, but that's not the same
> thing.

But you can use the reference in a hash as a hash key. That's the point.

> 
> > I would think the FAQ would better serve its readers if it explained
> > how they might use references as hash keys and what the limitations
> > are, rather than simply stating an untruth.
> 
> The FAQ is terse but correct.
> 
> Anno

How can the FAQ be correct when I can do this:

Jim 51% cat refkey.pl
#!/usr/local/bin/perl
use strict;
use warnings;

my $x = 'value of x';
my $rx = \$x;
my %hash;
$hash{$rx} = $x;
print "\$hash{\$rx} = '$hash{$rx}'\n";
print keys %hash, "\n";

Jim 52% perl refkey.pl
$hash{$rx} = 'value of x'
SCALAR(0x180a024)


Is this not "using a reference as a hash key directly"?

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com


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

Date: Tue, 18 Oct 2005 19:04:46 GMT
From: "Mike Schilling" <mscottschilling@hotmail.com>
Subject: Re: Microsoft Hatred FAQ
Message-Id: <iHb5f.3391$q%.177@newssvr12.news.prodigy.com>


"John Bokma" <john@castleamber.com> wrote in message 
news:Xns96F38418ADF38castleamber@130.133.1.4...
> Roedy Green <my_email_is_posted_on_my_website@munged.invalid> wrote:
>
>> On 18 Oct 2005 06:57:47 GMT, John Bokma <john@castleamber.com> wrote
>> or quoted :
>>
>>>>>That an HTML standard (ISO/IEC 15445:2000) and an HTML
>>>>>recommendation by w3c (4.01 for example) are two different things,
>>>>>and mixing them up by calling both standards is a bad thing.
>>>>
>>>> Because ... what are the consequences?
>>>
>>>If you mean if you are put in jail for 20 years, and tortured, none.
>>
>> No. ANY consequences.  You have not explained the downside.
>
> ISO HTML and HTML 4.01 differ. If you were asked to write a validating
> parser for the HTML standard, (as in ISO), and you wrote one for HTML 4.01
> (as in recommendation), you made quite a mistake.

There are standards that conflict, and also recommendations that conflict. 
Why is confusing standard A with recommendation P worse than

1.  confusing standard A with  standard B, or
2.  confusing recommendation P with  recommendation Q




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

Date: Tue, 18 Oct 2005 20:32:43 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Perl Script Question - Working with Directories
Message-Id: <dj3mq5.hk.1@news.isolution.nl>

Rich Barnes:

> Given a directory, I want to be able to distinguish which entries are
> files and which are directories... Actually I only want to list the
> directories in my output.
> 
> In a shell script I can easily accomplish this:

  for d in `ls -ap | grep /$`; do echo $d; done


> [ -d $VAR ]
> How can I accomplish the same task in PERL... basically, if I had the
> TEST command equiv in PERL I believe I could do this.

That is a SAQ: perldoc -f -d

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

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


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