The first thing I notice, and I will assume it was just a typo, is that you call
P::sss( $s );, yet you
package p;, which has a different name space than you expect. Again, I'll assume this was a typo.
The second thing that pops out to me is the code execution flow. Let me step through it, and you may see what's happening:
use P;
The package
P is compiled and code is executed (I will ignore
use strict; module for simplistic sakes). In code execution/compile time it will:
- Define $sl; lexically to the package. This is fine, though the variable has no value
- Attempt to print $l->{'Local_Port'}.
You may seee the issue here. Because the code gets compiled and executed at '
use' time,
$sl really hasn't been defined yet, and will therefore not be the hash (or blessed hash) reference you expect it to be.
Now, by then calling
P::sss( $s ) the
sss routine will
then define
$s1, print out the exepected contents and return out of the routine. Never again, however, will the
print $1->{'Local_Port'} be executed.
Overall, to get what you are looking for, you will have to find a way to define
$sl before the first print. Without knowing more about the overall application, I would hate to direct you in the wrong direction. Nevertheless, I hope this helped out with your initial question.
Good Luck!
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.