Advertisement
Guest User

Untitled

a guest
Jan 9th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. $^W = 1;
  3. $c = undef;
  4. while (<>) {
  5. tr/0-9A-Fa-f//cd;
  6. if (defined $c) { warn "Consuming $c"; $_ = $c . $_; $c = undef; }
  7. if (length($_) & 1) { s/(.)$//; $c = $1; }
  8. print pack "H*", $_;
  9. }
  10. if (!eof) { die "$!"; }
  11. if (defined $c) { warn "Odd number of hexadecimal digits"; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement