mirror of
https://github.com/rwxrob/dot
synced 2024-11-14 18:12:56 +00:00
15 lines
241 B
Plaintext
15 lines
241 B
Plaintext
|
#!/usr/bin/perl
|
||
|
|
||
|
# Sorts simple semantic versions.
|
||
|
|
||
|
use v5.18;
|
||
|
my @versions = <STDIN>;
|
||
|
|
||
|
sub num {
|
||
|
$_ = shift;
|
||
|
s/^v//;
|
||
|
sprintf "%09i%09i%09i", split /\./;
|
||
|
}
|
||
|
|
||
|
print(grep {s,^,v,} sort {num($a) <=> num($b)} grep {s,^v,,} @versions)
|