d/l speed calc. + size conv.

By Anish on Jul 26, 2009

This simple snippet can calculate the time required to download a particular file , and can convert KB(s) into MB(s) and Kb(s).

#!/usr/bin/perl -w
print "Type 1 for checking how much time it will take to download with a specified speed\n";
print "Type 2 to convert KBs into MBs and Kbs\n";
$choice = <STDIN>;
if ($choice == 1)
{
    print "Enter the speed ( in KBps )\n" ;
    $speed = <STDIN>;
    print "Enter the file size of the file to be downloaded (in KBs)\n";
    $size = <STDIN>;
    $time_ = $size / $speed;
    if ($time > 60)
    {
            $time_ = $time_/60; print $time_ ." minutes would be taken to download ".            $size ." KB(s)\n";
    }
    else        
    {
        print $time_ ." seconds would be consumed to download ". $size ." KB(s)\n";
    }
}
else
{
print "Type the amount of KBs\n";
$size2 = <STDIN>;
$MBs = $size2 / 1024 ;
$Kbs = $size2 / 8 ;
print  $MBs ." MBs and ". $Kbs ." Kbs\n" ;
}

Comments

Sign in to comment.
Anish   -  Aug 08, 2009

thanks a lot kasbah . Had not expected that good comment on my very first perl snippet . And thanks for rating

Btw , I'll be adding little more features soon

 Respond  
newklear   -  Aug 08, 2009

Brilliant Idea this.. this definately gives you a great start in improving on this, well done

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.