Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
version check
#perl 5.22.1 # vesrion tester # 0.1 < 1.1 -1 # 2.0 > 1.2 1 # 1.2 < 1.2_5 -1 #1.2.1 > 1.2_1 1 #1.2.1 = 1.2.1 0 print compareVersions("0.1" , "1.1"),"\n"; print compareVersions("2.0" , "1.2"),"\n"; print compareVersions("1.2" , "1.2_5"),"\n"; print compareVersions("1.2.1" , "1.2_1"),"\n"; print compareVersions("1.2.1" , "1.2.1"),"\n"; sub compareVersions{ my @aBits=map{my @tmp=split /_/,$_;($tmp[0],$tmp[1]//0)} (split /\./,shift); my @bBits=map{my @tmp=split /_/,$_;($tmp[0],$tmp[1]//0)} (split /\./,shift); my $result=0; while (scalar @aBits and scalar @bBits){ $result=(shift @aBits<=>shift @bBits); last if $result; } return $result; }
run
|
edit
|
history
|
help
0
base N conversion
Hash-Nevil
Perl
Perl - Sort hash of filenames by file extension
hashes
roni leonita 101745
Basics
Aishwarya 101701
Perl
perl circle plot