elsif ($message =~ /\.convert (\d+)([pPtTgGmMkK]?)([bB]?).+/) { my $amount = $1; my $mult = $2; my $bits = $3; print "Amt: $amount\nMul: $mult\nBit: $bits\n"; my $kilo = 1024; my $mega = $kilo * 1024; my $giga = $mega * 1024; my $tera = $giga * 1024; my $peta = $tera * 1024; if ($mult =~ /[pP]/) { $amount *= $peta; } elsif ($mult =~ /[tT]/) { $amount *= $tera; } elsif ($mult =~ /[gG]/) { $amount *= $giga; } elsif ($mult =~ /[mM]/) { $amount *= $mega; } elsif ($mult =~ /[kK]/) { $amount *= $kilo; } elsif ($mult eq "") {} else { print $client "NOTICE $who :Unknown modifier $mult\n"; print "[$stamp] NOTICE $who :Unknown modifier $mult\n"; } my $petaresult = $amount / $peta; my $teraresult = $amount / $tera; my $gigaresult = $amount / $giga; my $megaresult = $amount / $mega; my $kiloresult = $amount / $kilo; my $byteresult = $amount; print $client "PRIVMSG $where :$petaresult PB, $teraresult TB, $gigaresult GB, $megaresult MB, $kiloresult kB, $byteresult B\n"; print "[$stamp] PRIVMSG $where :$petaresult PB, $teraresult TB, $gigaresult GB, $megaresult MB, $kiloresult kB, $byteresult B\n"; }