Thread substr(): Alternative gesucht
(15 answers)
Opened by bloonix at 2007-07-02 15:44
Im ungewissen, obs denn relevant sei:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #!/usr/bin/perl use strict; use warnings; use Data::Dumper qw(Dumper); my $vector = '123456789'; my $bits = unpack 'b*', $vector; my @bits = split //, $bits; my @bytes; while (@bits) { #my $byte = pack 'b8', join '', splice(@bits, 0, 8); # 1-byte (ascii) #my $byte = join '', splice(@bits, 0, 8); # 8-bit (bits) #my $byte = join '', splice(@bits, 0, 64); # 64-bit (bits) push @bytes, $byte; } print Dumper \@bytes; #1 #2 Code: (dl
)
1 $VAR1 = [ #3 Code: (dl
)
1 $VAR1 = [ <!--EDIT|shigetsu|1183389239--> |