$ibm_float = (( $sign_bit )*( 16**( $exponent - 64 ) ) * $fraction )/3000; #### $aux = $_[0]; $aux = shift; #### sub conv_bit_string_2_ibm32float { my( $first_digit, $bin_exponent, $bin_fraction ) = unpack 'A1A7A24', $_[ 0 ]; my $sign_bit = ( -1 ) ** $first_digit; my $exponent = bin2dec( $bin_exponent ); my $place_holder = -1; my $fraction = 0; foreach my $bit ( split '', $bin_fraction ) { $fraction += $bit * ( 2 ** $place_holder ); $place_holder += -1; } my $ibm_float = ( ($sign_bit ) * ( 16 ** ( $exponent - 64 ) ) * $fraction ); return $ibm_float; } sub bin2dec { return unpack( "N", pack( "B32", substr( "0" x 32 . shift, -32 )) ); }