develooper Front page | perl.perl5.porters | Postings from June 2015

scalar sort $scalar

Thread Next
From:
H.Merijn Brand
Date:
June 28, 2015 08:43
Subject:
scalar sort $scalar
Message ID:
20150628104305.44f07131@pc09.procura.nl
Would sorting a scalar be a logical behavior or would it break things

$ perl -wE'say reverse "bdca"'
bdca
$ perl -wE'say scalar reverse "bdca"'
acdb

$ perl -wE'say sort "bdca"'
bdca
$ perl -wE'say scalar sort "bdca"'
Useless use of sort in scalar context at -e line 1.
Use of uninitialized value in say at -e line 1.


That could easily be transformed into producing
$ perl -wE'say scalar sort "bdca"'
abcd

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.21   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

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