I have just discovered that it's not as simple a matter to swap entries from one hash to another as I had thought.
I am trying to assign an array of four hashes to another array of four hashes -- and it looks to me like that is a big "no-no".
Here's an example:
#!/user/bin/perl -w
use strict;
my %linkTitle;
my %linkCategory;
my %linkBlurb;
my %linkUrl;
(%linkTitle,%linkCategory,%linkBlurb,%linkUrl) = AssignValues();
# apparenty this (or the other similarly commented statement or
#both) is illegal and/or doesn't do what I think it should.
# Print the assigned values:
my $counter;
for ($counter = 0; $counter < 3; $counter++)
{
print "linkTitle{$counter} is set to $linkTitle{$counter}";
print "linkCategory{$counter} is set to $linkCategory{$counter}";
+
print "linkBlurb{$counter} is set to $linkBlurb{$counter}";
print "linkUrl{$counter} is set to $linkUrl{$counter}";
}
sub AssignValues()
{
my %assignTitle;
my %assignCategory;
my %assignBlurb;
my %assignUrl;
$assignTitle{0} = "Yahoo!";
$assignCategory{0} = "Search Engines";
$assignBlurb{0} = "Perhaps you've heard of it.";
$assignUrl{0} = "http://www.yahoo.com/";
$assignTitle{1} = "Slashdot";
$assignCategory{1} = "Tech News";
$assignBlurb{1} = "News for nerds. Stuff that matters.";
$assignUrl{1} = "http://www.slashdot.org/";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.