open BINARY_IN,"<binary.txt" or die "can not open file binary.txt:$!";
open DECIMAL_OUT,">decimal.txt" or die "can not create file decimal.txt:$!";
while (<BINARY_IN>)
{
my @binary_strings = split;
foreach my $a (@binary_strings)
{
printf DECIMAL_OUT "%d\n ",oct('0b'.$a);
}
}
close BINARY_IN;
close DECIMAL_OUT;