Added POD tests and a Perl::Critic test
[nasm/perl-rewrite.git] / perl / lib / Nasm / Utils.pm
bloba7900e53b08134c402ff34e02faed7771e73993d
1 =head1 NAME
3 Nasm::Regs::Register
5 =cut
7 package Nasm::Utils;
8 use strict;
9 use warnings;
11 use base 'Exporter';
13 our @EXPORT_OK = qw{
14 str2hex
15 addprefix
19 # Turn a numeric list into a hex string
20 sub str2hex{
21 my @return = map {sprintf("%02X", $_)} @_;
23 return @return if wantarray;
24 return join '', @return;
27 sub addprefix{
28 my ($prefix, @list) = @_;
29 my @return = map {
30 sprintf("%s%02X", $prefix, $_)
31 } @list;
33 return @return if wantarray;
34 die "Don't know what to do in scalar context.";