The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. March 11, 2010, 10:49:26 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: alpha-num numbering scheme in perl  (Read 2647 times)
perl8user
n00b
*
Offline Offline

Posts: 3


View Profile
« on: June 22, 2009, 05:29:05 AM »

Hi,
  Does anyone know how to get the alpha-numeric numbering scheme in perl ?
For example the
numberic        => 0,1,2,...9,10,11,12,...99,100,...   # $x = 0;$x++;
lower-alpha     => a,b,c,...z,aa,ab,ac,...zz,aaa,...   # $x = "a";$x++;
upper-alpha     => A,B,C,..,Z,AA,AB,AC,...ZZ,AAA,...   # $x = "A";$x++;
lower-alpha-num => a,b,c,...z,0,1,2,3,...9,aa,ab,ac,...zz,10,11,12,...99,aaa,...   # ?
upper-alpha-num => A,B,C,..,Z,0,1,2,3,...9,AA,AB,AC,...ZZ,10,11,12,...99,AAA,...   # ?

cvv3@yahoo.com
Logged
dirk
Global Moderator
Expert
*****
Offline Offline

Posts: 398


View Profile
« Reply #1 on: June 22, 2009, 08:15:08 AM »

Hi perl8user,

I have found another interesting usage of the magical autoincrement operator:

Code:
$x = 'a0';

for ( $i=1; $i<=100; $i++ ) {
    print $x++ . "\n";
}

Output: a0 a1 a2 a3 a4 a5 a6 a7 a8 ... j3 j4 j5 j6 j7 j8 j9 k0

Anyway, that doesn't answer your question.

I don't think that lower-alpha-num and upper-alpha-num are possible using a simple syntax.

Dirk
Logged
Bompa
Administrator
Expert
*****
Offline Offline

Posts: 351


View Profile WWW
« Reply #2 on: June 22, 2009, 07:26:21 PM »

sorry, way over my head.
Logged

Do You Know?
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!