[grand-rapids-pm-list] Perl Puzzle!

grand-rapids-pm-list at pm.org grand-rapids-pm-list at pm.org
Fri Oct 10 11:25:43 PDT 2008


So.. not sure if the answer was given yet. Someone hinted, i thought,  
when they mentioned the ascii character set.

The 'ge' comparison operator (i think) uses the ascii table to  
compare strings. On the ascii table, the character 0 (zero) is not  
the lowest. Most non-alphanumeric characters are below zero on the  
table. So for example, a right bracket will be lower than zero.

It should be noted that, if I am right, i had to look it up. I did  
not know this off the top of my head.

- Brian

On Oct 10, 2008, at 10:52 AM, grand-rapids-pm-list at pm.org wrote:

> Here's something that tripped me up that I thought I'd share as a  
> Perl Puzzle...
>
> Q1: For what value(s) of $a do the following comparisons return  
> different results?
>
> $a >= 0
> $a ge 0
>
> Q2: Ok, it isn't hard to guess. But, why? The answer reveals  
> something unique about Perl that is very important to keep in mind.
>
>
> Feel free to reply to the list. I'll post the answer later today if  
> no one nails it.
>
> -Ed
> _______________________________________________
> grand-rapids-pm-list mailing list
> grand-rapids-pm-list at pm.org
> http://mail.pm.org/mailman/listinfo/grand-rapids-pm-list

Brian Barto
616.856.4551
bbarto at stacksys.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/grand-rapids-pm-list/attachments/20081010/03d0010f/attachment-0001.html>


More information about the grand-rapids-pm-list mailing list