> Hi there,
>
> Hereby I have a string parsing problem to ask. The sample strings look
> like this:
>
> 00000000: CC02 0000 0565 0000 8E93 D501 0100 6273 .....e........b
> 00000000: 6800 0000 0500 0000 9093 D501 0100 1400 h...............
>
> What I am interested is the the 21st and 22nd byte value. In the above
> examples, they are both 05.
>
> Could anybody tell me how to retrieve that value out of the strings
> using regular expression?
>
> Thanks in advance!
substr
#!/usr/bin/perl
use strict;
while (<DATA>) {
my $substring20 = substr( $_, 20, 1 );
my $substring21 = substr( $_, 21, 1 );
print "$substring20$substring21\n";
}
__DATA__
00000000: CC02 0000 0565 0000 8E93 D501 0100 6273 .....e........b
00000000: 6800 0000 0500 0000 9093 D501 0100 1400 h...............
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/