in reply to Schwartzian Transfrom using a subroutine
I am getting the original sorting of the list.
Because your sub doesn't return the transformed string; it returns the result of the the last transform. Change that to:
sub transform{ my $string = shift; $string =~ tr/A-Z/a-z/;#kleinschreibung $string =~ tr/a-z//cd; $string; }
(As an aside; are you aware that for my $word (@output){say $word;} is more easily written as say for @output?)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Schwartzian Transfrom using a subroutine
by oliverhuber (Initiate) on Jan 09, 2013 at 12:13 UTC | |
|
Re^2: Schwartzian Transfrom using a subroutine
by jwkrahn (Abbot) on Jan 09, 2013 at 13:33 UTC | |
by BrowserUk (Patriarch) on Jan 09, 2013 at 13:45 UTC |