use strict; my $hex = "24d0e803adb7"; for (0..16) { $hex = inc_hex($hex); print $hex, "\n"; } sub inc_hex { my @a = reverse map {hex} split '', $_[0]; $a[my $i = 0]++; while ($a[$i] == 16) { $a[$i] = 0; $a[++$i]++; } return join '', map {sprintf "%x", $_} reverse @a; }