#!/usr/bin/perl -wT ## ## $Id$ ## ## Take a raw serial number from the "ds2490" USB program and re-arrange ## the pairs of digits to form a sensible Puce-style serial number. The ## CRC byte is dropped if present. ## ## Normal usage:- cat file-full-of-serial-numbers | parse_serial.pl ## use strict; my $serial = ""; while ( <> ) { my $i = 12; chomp(); if (length($_) == 14) { $serial = substr($_, 0, 12); } else { $serial = $_; } for ($i = 12; $i > 0; $i--) { print substr($serial, ($i - 2), 2); $i--; } print "\n";; } exit;