#! perl -sw use strict; $/ = \39; ## Read 3 lines as a single record while( ) { my $rep = sprintf '%02d', int rand 100; substr $_, 0, 2, $rep; substr $_, 14, 2, $rep; substr $_, 27, 2, $rep; print; } __DATA__ 57KXNWLRZWJ3 057E8bf0D030 057E8bf0D032 58KXNWLRZWKB 058E8bf0D02A 058E8bf0D02C