• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Help! A quick Perl question...

csiro

Golden Member
I'm just starting to learn Perl and I couldn't figure how to do this.

I need to parse strings such as these from a text file..

~ # rf: 0x7E 0x23 0x21 0x20 0x7E

I just need the Hex values without the 0x put into an array so the line above should be

7E 23 21 20 7E.

I've tried doing something like @frame = split (/[^\d^A-F]+/, $_); but I end up with
something like this

0 7E 0 23 0 21 0 20 0 7E

How do I remove the leading zeroes??

😕
 
I gave that a try but it returned the input.

ie. input = ~ # rf: 0x7E 0x23 0x21 0x20 0x7E
result = ~ # rf: 0x7E 0x23 0x21 0x20 0x7E

Edit: Nevermind. Thanks that works.
 
Back
Top