Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thanks for you answer. It solves my problem! No, it is not my homework (got something else). I'm just trying to create a script where I need something similar (no families and no flinstones ;). I didn't want to write the full code, since I only need this in a single sub. I am using strict, warnings, diagnostics and even perlcritic (cruel). I played around with something like this:
get_family_member('bart',$families); sub get_family_member { my @args = @_; my $who = shift @args; my $families = shift @args; foreach my $family (%families) { if ($families->{$family}->{kid} eq "bart") { return $dfamilies->{$family}->{kid}; last; } } }
but where would I say, it should die, when 'bart' is not found? It has been a while since I used perl the last time. I returned, because I missed the nice community and CPAN. However, since I used some more exotic languages (far away from C-like styles and paradigms) I guess I need to rewire my brain. I hope I remember correctly, how Perls scopes and datatypes work. Maybe I should just try to find my old perl books.

In reply to Re^2: Finding hashes in hashes of hashes by cyphy
in thread Finding hashes in hashes of hashes by cyphy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-03-28 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found