LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Islaw R. Date: Wed Sep 29 13:30:58 2004 Subject: Re: Odd sort() problem
Paul Lalli wrote: > "187" <bigal187@invalid.rx.eastcoasttfc.com> wrote in message > news:2s0bj9F1f8ihqU1@uni-berlin.de... >> A. Sinan Unur wrote: >>> "187" <bigal187@invalid.rx.eastcoasttfc.com> wrote in >>> news:2s07v9F1fvtn5U1 @uni-berlin.de: >>> >>>> C:\> perl -e "print qq{\n}, join(qq{\n}, sort { lc{$a} cmp >>>> lc($b) } split(/;/, $ENV {'PATH'})), qq{\n};" >>> >>> I like one liners but I avoid them precisely for this type of >>> problem: lc{$a} should be lc($a) or just lc $a. >> >> But what I really don't understand is why it doesn't result in a >> compile error? lc{$a}, one would think, is not a valid statement. > > The warning below answers this question. > >> I admit should I have used -w in there: >> >> Odd number of elements in anonymous hash at -e line 1. >> Odd number of elements in anonymous hash at -e line 1. >> Odd number of elements in anonymous hash at -e line 1. >> [......] >> > > You're passing to the lc() function an anonymous hash. That anonymous > hash is poorly constructed, containing an odd number of elements. So > it is not invalid syntax, it's just not at all what you meant. > > Paul Lalli -- 187
| Navigate in group perl.bugmongers at sever nntp.perl.org | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |