Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Schwartzian Transfrom using a subroutine

by BrowserUk (Patriarch)
on Jan 09, 2013 at 11:53 UTC ( [id://1012460]=note: print w/replies, xml ) Need Help??


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?)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Schwartzian Transfrom using a subroutine
by oliverhuber (Initiate) on Jan 09, 2013 at 12:13 UTC
    Many thanks! It's working now. Thanks also for the sidenote!
Re^2: Schwartzian Transfrom using a subroutine
by jwkrahn (Abbot) on Jan 09, 2013 at 13:33 UTC
    (As an aside; are you aware that for my $word (@output){say $word;} is more easily written as say for @output?)

    They are not the same:

    $ perl -E'my @x = qw/one two three/; for my $x ( @x ) { say $x }' one two three $ perl -E'my @x = qw/one two three/; say @x' onetwothree
      perl -E'my @x = qw/one two three/; say @x'

      You missed something...

      is more easily written as say for @output?) #.............................^^^

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1012460]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 15:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found