- You shouldn't use Switch.pm, it has subtle bugs.
- What's the switch for here anway, all you're doing is execute one "case" after the other, there's no fall-through or anything that requires this execution out of a standard for-loop.
- Running this codes gives the following output:
0 --HASH(0x82bfd04) Data_Directories_fetch
1 --HASH(0x828b9a8) Data_Directories_erase
2 --HASH(0x82bbf40) Program_fetch
3 --HASH(0x82bfcbc) Program_erase
4 --HASH(0x82bbec8) Configuration_and_Table_Files_erase
5 --HASH(0x815b734) Configuration_and_Table_Files_fetch
6 --HASH(0x82bbee0) Create_Database
7 --HASH(0x82bbe38) Load_Database
HASH(0x82bbf40)
Result: HASH(0x82bbf40)
Loading some values into the Program_fetch hash first gives:
0 --HASH(0x82bc21c) Data_Directories_fetch
1 --HASH(0x82bfd00) Data_Directories_erase
2 --HASH(0x8160c8c) Program_fetch
3 --HASH(0x82bc0f0) Program_erase
4 --HASH(0x82bfce8) Configuration_and_Table_Files_erase
5 --HASH(0x815b728) Configuration_and_Table_Files_fetch
6 --HASH(0x82bc12c) Create_Database
7 --HASH(0x82bfd84) Load_Database
HASH(0x8160c8c)
1 => 2
3 => 4
Result: HASH(0x8160c8c)
1 => 2
3 => 4
Which is exactly what I'd expect. What are you expecting to see?
There are ten types of people: those that understand binary and those that don't.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|