develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [perl #24482] 5.8.2: sort CORE::keys() results in subroutine in sort

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
November 16, 2003 09:10
Subject:
Re: [perl #24482] 5.8.2: sort CORE::keys() results in subroutine in sort
Message ID:
20031116180955.62444510.rgarciasuarez@free.fr
James Jurach (via RT) wrote:
> 
>  $ perl -we '%a=(a=>"b"); print((sort CORE::keys(%a)),"\n")'
>  Undefined subroutine in sort at -e line 1.
> 
>  $ perl -we '%a=(a=>"b"); print((sort keys(%a)),"\n")'
>  a

This is due to two facts :

- perl will parse "sort foo(...)" and "sort(foo ...)" as "sort foo ..."
  In other words, it doesn't take the parens into account
- perl parses CORE::keyword as a subroutine, not as the corresponding
  keyword.

Fixing this would probably break backward incompatibility in
undesirable ways.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About