Possible Duplicate:
How do I get the size of a file in megabytes using Perl?
I tried some ways to convert MB into TB in perl, but value does not match in perl output and online converter.
whats the best formula to convert the above.
Possible Duplicate:
How do I get the size of a file in megabytes using Perl?
I tried some ways to convert MB into TB in perl, but value does not match in perl output and online converter.
whats the best formula to convert the above.
If you don't want any digits after the decimal, you can just shift to the right by 20 bits:
perl -e 'print 202220394 >> 20;'
gives 192
. Whereas 202 220 394 megabytes = 192.852396 terabytes.
If you want the decimals, divide by 2^20:
perl -e 'print 202220394 / (1 << 20);'
gives 192.852396011353
.