Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Compare Versions
#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(1) { $result=(shift @aBits<=>shift @bBits); last if $result or not(scalar @aBits and scalar @bBits); $aBits[1]+=$aBits[0]/100;shift @aBits; $bBits[1]+=$bBits[0]/100;shift @bBits; } return $result; }
run
|
edit
|
history
|
help
0
matrx travarsal
main_objetos
Sortttttttt
Riyali-101738
test hello world perl n texs
Arrayop
Quotes
2nd
PWC 059-1
grid