Front page | perl.beginners |
Postings from February 2002
To create a hash of lists
Thread Next
From:
William.Crain
Date:
February 21, 2002 16:35
Subject:
To create a hash of lists
Message ID:
C5D1F8729F14D511AC3B0220484037D0024EEA23@vexwrst02.hurlburt.af.mil
Using the following code, I want to create a hash or individual lists. Of
course, this code doesn't work....
What do I need to change to correct my error?
--- Code follows -----------------------
#!/perl/bin/perl
use strict;
my %printQueue;
push($printQueue{A}, 'This is the first line in A');
push($printQueue{A}, 'This is the second line in A');
push($printQueue{A}, 'This is the third line in A');
push($printQueue{A}, 'This is the fourth line in A');
push($printQueue{A}, 'This is the fifth line in A');
push($printQueue{B}, 'This is the first line in B');
push($printQueue{B}, 'This is the second line in B');
push($printQueue{B}, 'This is the third line in B');
push($printQueue{B}, 'This is the fourth line in B');
push($printQueue{B}, 'This is the fifth line in B');
push($printQueue{C}, 'This is the first line in C');
push($printQueue{C}, 'This is the second line in C');
push($printQueue{C}, 'This is the third line in C');
push($printQueue{C}, 'This is the fourth line in C');
push($printQueue{C}, 'This is the fifth line in C');
foreach my $key ('A', 'B', 'C') {
foreach my $text ($printQueue{$key}) {
print("$text \n");
}
}
Thread Next
-
To create a hash of lists
by William.Crain