You'll need to open the file first. eg:
open my $in, '<', 'file.txt' or die "Cannot open file for reading: $!" +; print sort { ($a =~ /\S+\n$/g)[0] cmp ($b =~ /\S+\n$/g)[0] } <$in>; close $in;
See open and close for all the details.
In reply to Re^3: Sort alphabetically from file
by hippo
in thread Sort alphabetically from file
by edujs7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |