$data .= chr hex $1 while $encoded_pair =~ s/(..)//; #### $data = join '', map { chr hex $_ } $encoded_pair =~ /(..)/g;