my $str = 'fe0401'; my @arr = $str =~ /([0-9a-f]{2})/g; map { $_ = hex $_ } @arr;