fork download
  1. #!/usr/bin/perl
  2. use 5.016;
  3. use warnings;
  4.  
  5. sub f {
  6. return sub{
  7. $_[0], map{ $_[ $_ - ($_[$_ - 1] gt $_[$_]) ], $_[$_] } (1 .. $#_)
  8. }->(split //, shift);
  9. }
  10.  
  11. say f("Personal");
  12. say f("Hello, world!");
  13.  
Success #stdin #stdout 0s 3736KB
stdin
Standard input is empty
stdout
Peerrsssoonnall
Heellllooo,, wwworrrlldd!