Text sorter, by lenght - Perl

Researching, Proof of Concepts, Hacking, Console Modding and Hacking and more. No game hacking / modding here.
Post Reply
User avatar
Sethioz
Admin
Admin
Posts: 4764
Joined: Fri Jul 27, 2007 5:11 pm
Custom: Gaming YT > https://youtube.com/SethiozEntertainment
Game Hacking YT > https://youtube.com/sethioz
Game Hacks Store > https://sethioz.com/shopz
Location: unknown
Contact:

Text sorter, by lenght - Perl

Post by Sethioz »

Sorts text file's content by lenght. Raptor can also do that, but this is just a simple script.

Code: Select all

#!/usr/bin/perl

print "usage:
sortbylenght.pl <file_to_sort.txt> file_to_save.txt";

@list = <>;

sub sortIt {
   length($a) <=> length($b);
}

foreach $curr (sort sortIt (@list)) {
  $curr =~ s/[\n\r]//g;
  print "$curr\n";
}
Post Reply