On 11-04-27 12:47 PM, Jim Gibson wrote:
The metasymbol \d matches the characters [0-9], not the extended hexadecimal
set that includes A-Z. To match those, construct your own character class:

[0-9A-Z]

You can use the POSIX xdigit character class instead:

#!/usr/bin/env perl

use strict;
use warnings;

use Data::Dumper;

# Make Data::Dumper pretty
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Indent   = 1;

# Set maximum depth for Data::Dumper, zero means unlimited
local $Data::Dumper::Maxdepth = 0;

while( <DATA> ){
  my @hex_numbers = ( m{ ( [[:xdigit:]]+ ) }gmsx )[ 0, -1 ];
  print '@hex_numbers: ', Dumper \@hex_numbers;
}

__DATA__
0079 Not Visible             6000097000029260057253303030373
007A Not Visible             6000097000029260057253303030374
007B Not Visible             6000097000029260057253303030374
007C Not Visible             6000097000029260057253303030374
007D Not Visible             6000097000029260057253303030374
007E Not Visible             6000097000029260057253303030374


See `perldoc perlreref` and search for /xdigit/


--
Just my 0.00000002 million dollars worth,
  Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to