Find the longest word
|
|
So this isn't that useful (or efficient) but I thought it was cool anyway. It rips through a file, finds the longest word and prints it out. #!/usr/bin/perl;
open(INFILE, $ARGV[0]) or die "File Not Found, or you didn't give me one. Shmuck. \n";
@sorted = sort {length $a <=> length $b} map {split(/\s+/,$_)} <INFILE>;
print pop @sorted;
close INFILE;
|