Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

References in Perl

by misterMatt (Novice)
on Aug 02, 2009 at 00:38 UTC ( #785157=perlquestion: print w/ replies, xml ) Need Help??
misterMatt has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks. Could someone please slowly walk me through the use of references in the code examples from the error handling portion of the File::Path docs? (http://perldoc.perl.org/File/Path.html#ERROR-HANDLING)

Comment on References in Perl
Re: References in Perl
by Anonymous Monk on Aug 02, 2009 at 00:49 UTC
    Which ones? Cut/paste into <code></code> tags.
    rmpath( '/no/such/path', {error => \my $err} );
    is the same as
    my $err; rmpath( '/no/such/path', {error => \$err} );
    does that help?
Re: References in Perl
by jbt (Chaplain) on Aug 02, 2009 at 02:11 UTC
    A reference "\$err" is passed to rmpath rather than return the errors. When rmpath returns, the local $err reference either points to an empty list if there are no errors, or a list of file/message hash references. The reference $err is dereferenced as "@$err" (an array). The file/message hash references in the array are defererenced as "%$diag" and the each function converts it into a two element list.
Re: References in Perl
by Marshall (Prior) on Aug 02, 2009 at 04:01 UTC
    I don't know how to help you. It would be helpful if you posted some code and explained why you are having problems with that code. Or better yet, first of all to explain what you need in terms of functionality and then post some code with the problems. What you are trying to do and why you think you need a particular thing is often key to improving things. Sometimes what folks "want" isn't what they "need".

    You are basically saying that you don't understand: http://perldoc.perl.org/File/Path.html#ERROR-HANDLING

    That's fair enough. I'm sure that much could be improved. But I can't take on re-writing that part of Perl doc (which is what you are asking for) without understanding where the problem is..

Re: References in Perl
by stevemayes (Scribe) on Aug 02, 2009 at 06:56 UTC
      These diagrams are helpful.

      I would recommend: "Advanced Perl Programming" by S. Srinivasan. A student who doesn't have at least 2-3 quarters of 'C' will find the text challenging. Chapter 20, "Perl Internals" is quite informative as are others.

      The OP has posed a very broad question, the general answer to which, just won't fit in a single Monk post. The question just has to get more specific otherwise at least I am unable to help further.

        Thank you for the reference - no pun intended :)

        I was replying direct to the OP, as a new Perlmonk I wouldn't even imagine an experienced Monk would need my help in outlining a Perl concept.

        I would recommend: "Advanced Perl Programming" by S. Srinivasan.

        An absolutely excellent book from 1997(!), which is unfortunately out of print! 8(

        There are some free PDF copys in the web but I don't know if they are legal.

        At our last perlmongers meeting all agreed how good this book is!

        (And I always wondered what happened to the author, seems he left the scene completely)

        Sorry can't say much about the - completely different - actual print with the same title , haven't read it!

        Cheers Rolf

        UPDATE: bio, bookreview

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://785157]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2014-10-30 16:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls