====== Bytes und Einheiten umrechnen ====== sub convert_bytes { if ($_[0] < 1024) { $converted_value = $_[0]; $converted_unit = "Bytes" } elsif ($_[0] < 1024*1024) { $converted_value = $_[0] / 1024; $converted_unit = "KB" } elsif ($_[0] < 1024*1024*1024) { $converted_value = $_[0] / 1024 / 1024; $converted_unit = "MB" } elsif ($_[0] < 1024*1024*1024*1024) { $converted_value = $_[0] / 1024 / 1024 / 1024; $converted_unit = "GB" } elsif ($_[0] < 1024*1024*1024*1024*1024) { $converted_value = $_[0] / 1024 / 1024 / 1024 / 1024; $converted_unit = "TB" } } sub analyse_unit { if ($_[0] =~ m/KB/) { $_[0] =~ tr/KB//d; $converted_value = $_[0] * 1024 } elsif ($_[0] =~ m/MB/) { $_[0] =~ tr/MB//d; $converted_value = $_[0] * 1024 * 1024 } elsif ($_[0] =~ m/GB/) { $_[0] =~ tr/GB//d; $converted_value = $_[0] * 1024 * 1024 * 1024 } elsif ($_[0] =~ m/TB/) { $_[0] =~ tr/TB//d; $converted_value = $_[0] * 1024 * 1024 * 1024 * 1024 } else { $converted_value = $_[0] } } sub analyse_percent { printV $_[0]; if ($_[0] =~ m/%/) { $_[0] =~ tr/%//d; $converted_value = $_[0] } else { $converted_value = $_[0] * 100 } }