#!/usr/bin/perl -w use strict; my %next; BEGIN { @next{'0'..'9','A'..'Z'}= ('1'..'9','A'..'Z','0'); } sub inc36 { my $add= ""; my $dig; while( not $dig= $next{chop($_[0])} ) { $add .= $dig; if( ! length($_[0]) ) { $dig= '1'; last; } } $_[0] .= $dig . $add; } while( ) { for( split " " ) { print "$_ + 1 = "; inc36( $_ ); print $_,$/; } } __END__ 0 1 9 A Y Z 10 19 1Z 9Z AZ ZZ YZZ XYZZY XYZZZ