Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: incrementing mixed letters and numbers

by tybalt89 (Monsignor)
on Aug 22, 2017 at 14:28 UTC ( [id://1197807]=note: print w/replies, xml ) Need Help??


in reply to incrementing mixed letters and numbers

#!/usr/bin/perl -040l # http://perlmonks.org/?node_id=1197777 use strict; use warnings; my @alphabet = (0..9, 'a'..'z'); my %next; @next{@alphabet} = @alphabet[1..$#alphabet]; $_ = '0zyw'; # let's start at some place interesting for my $n ( 1..200 ) { print; s/(.)(z*)$/ $next{$1} . $2 =~ tr!z!0!r /e; # advance }

Prints:

0zyw 0zyx 0zyy 0zyz 0zz0 0zz1 0zz2 0zz3 0zz4 0zz5 0zz6 0zz7 0zz8 0zz9 +0zza 0zzb 0zzc 0zzd 0zze 0zzf 0zzg 0zzh 0zzi 0zzj 0zzk 0zzl 0zzm 0zzn + 0zzo 0zzp 0zzq 0zzr 0zzs 0zzt 0zzu 0zzv 0zzw 0zzx 0zzy 0zzz 1000 100 +1 1002 1003 1004 1005 1006 1007 1008 1009 100a 100b 100c 100d 100e 10 +0f 100g 100h 100i 100j 100k 100l 100m 100n 100o 100p 100q 100r 100s 1 +00t 100u 100v 100w 100x 100y 100z 1010 1011 1012 1013 1014 1015 1016 +1017 1018 1019 101a 101b 101c 101d 101e 101f 101g 101h 101i 101j 101k + 101l 101m 101n 101o 101p 101q 101r 101s 101t 101u 101v 101w 101x 101 +y 101z 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 102a 102b 10 +2c 102d 102e 102f 102g 102h 102i 102j 102k 102l 102m 102n 102o 102p 1 +02q 102r 102s 102t 102u 102v 102w 102x 102y 102z 1030 1031 1032 1033 +1034 1035 1036 1037 1038 1039 103a 103b 103c 103d 103e 103f 103g 103h + 103i 103j 103k 103l 103m 103n 103o 103p 103q 103r 103s 103t 103u 103 +v 103w 103x 103y 103z 1040 1041 1042 1043 1044 1045 1046 1047 1048 10 +49 104a 104b 104c 104d 104e 104f

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1197807]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-16 17:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found