#!/usr/bin/perl -w use strict; use warnings; foreach my $test ( '0.710.08', '1.93_99', '1.94_53', '1.94_54', '1.94_55', '23', '13,56', ) { print "Version '$test' = " . versionsangabe ($test) . "\n"; } sub versionsangabe { my $pot = -1; my $zahl = ''; my $ergebnis = 0; for (my $pos = length ($_[0]) - 1; $pos >= 0 ; $pos --) { my $char = substr ($_[0],$pos,1); if ( $char =~ /[^0-9]/ || !$pos ) { $pot ++; $zahl = "$char$zahl" if !$pos; $ergebnis += $zahl * (10 ** $pot); $zahl = ''; } else { $zahl = "$char$zahl"; } } return $ergebnis; }