http://www.perlmonks.org?node_id=1006985


in reply to Problem while Data Extraction

It may be that on my first reading of your node I understood it backwards, in which case the following code is more likely useful:

#!/usr/bin/perl use strict; use warnings; while (<DATA>) { chomp; my @parts = split /(\|[^\|]*\|)/; for my $part (@parts) { if ($part =~ /\|(.*)\|/) { $part = join '', $part =~ /([\da-f]+)/ig; } else { $part = join '', map {sprintf '%02x', ord $_} split '', $p +art; } print $part; } print "\n"; } __DATA__ |30 31 32 33 34|.dropbox.com User-Agent|3A|Google|20 20|Desktop

Prints:

30313233342e64726f70626f782e636f6d 557365722d4167656e743A476f6f676c6520204465736b746f70
True laziness is hard work