"Dharshana Eswaran" schreef: > The input is "31","59", "4C","15","53","DD","54","31" > > The above input is represented as shown below: > 00110001 01011001 01001100 00010101 01010011 11011101 01010100 > 00110001 > > The correction in the desired output is > > 0110001 > 0110010 > 0110001 > 0101010 > 0110001 > 0101010 > 0110111 > > The output should have 7bits for each representation. That is 8th bit > of the 1st byte is taken as the 0th bit of the next byte and 7th and > 8th of the second bytes becomes the 0th and 1st of the third byte, > next 6th, 7th,8th of the third becomes 0th,1st,2nd of the > fourth....And so on....
#!/usr/bin/perl use warnings ; use strict ; my $data = join("\n", map {sprintf "%08b", $_} map hex, <DATA> =~ /[[:xdigit:]]+/g) . "\n" ; 1 while $data =~ s/(.+?)(.{7}\n.*)/$2$1/ ; print "$data\n" ; __DATA__ "31","59", "4C","15","53","DD","54","31" -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>