CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...: print numbers from 1 to 100 and a to z as index by using hashes: Edit Log



vikasmetla
Novice

Apr 23, 2014, 11:37 PM


Views: 17113
print numbers from 1 to 100 and a to z as index by using hashes

hi perl guru's

i need help ..

i want to a program that print 1 to 100 numbers and a to z alphabets parallel...after completing a to z of 26 numbers and repeat the alphabets again then start 'a' with 27 number and ....
and repeat up to 100...the program want write with using hashes only...

i tried with some code..plz check and modifiy it ...



Code
#!/usr/bin/perl 

my @string=(a..z);
my @numbers=(1..100);
@hash{("a".."z")}=(1..100);
foreach $value(sort
keys %hash)
{
print "$value: $hash{$value}\n";
}
o/p:-

a:1
b:2
c:3
.
.
.
.
x:24
y:25
z:26


but i want output like this........

output:-

a:1
b:2
c:3.
.
.
.
.
.
x:24
y:25
z:26
a:27
b:28
c:29
.
.
.
.
.
.
.
.
?:100


(This post was edited by vikasmetla on Apr 23, 2014, 11:49 PM)


Edit Log:
Post edited by vikasmetla (Novice) on Apr 23, 2014, 11:49 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives