Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Word reverseby amigero (Novice) |
on Oct 13, 2010 at 23:29 UTC ( [id://865177]=perlquestion: print w/replies, xml ) | Need Help?? |
amigero has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, I cherish your knowledge, with thoughts of giving bread to the needy as I write this message.
I am dealing with binary data. In a hex editor ("fred") the lines would look like this. 45d2ff76893a0033 45d239a7dd200116 I have been extracting this data using the following command. unpack('v4',$rec) However, I now need to word reverse this data. so I need some code to make the above become: ff7645d20033893a 39a745d20116dd20 I know I can do the following for(my $jj=0;jj<4;jj++){ $skipper = 50+jj*2; push @data, reverse unpack('x$skipper v2',$record) } But, is there a one-liner I can use? Efficiency is critical
Back to
Seekers of Perl Wisdom
|
|