http://qs321.pair.com?node_id=1078518


in reply to Re^2: Given When Syntax
in thread Given When Syntax

  1. You have no sub test2 { ...}
  2. You show use of strict and warnings but you should have seen a message that return is not valid as your code presents it: "Can't return outside a subroutine..."
  3. You don't have any mechanism for output -- no print of the return value, were the return actually valid.

Further, inclusion of comments which have no relevance to your problem merely makes your code more verbose, and thus, less likely to be a candidate for a reply by Monks who have other demands on their time. You shouldn't waste it if you really "appreciate (our) time."

So here's an Rx: make sure you have your fundamentals down... and use that knowledge to recognize when you've been given an outline; not a line-for-line code solution. (Offering that kind of response is wholly in keeping with the Monastery ethos: we're here to help you learn; not to spoonfeed you with solutions!)

Updated by addition of thoughts in last para following the ellipsis.

Update2/clarification/correction: (yeah, my remark re comments is too broad, in insufficiently precise.) My intent -- now "better phrased" I hope -- was to point out that non-code info on the problem belongs in the narrative -- not in the code -- and that code that's been commented out should be omitted unless it casts some NEW light on the problem -- which is not the case with OP's reposting of Marshall's well-taken comment on the efficiency of the construct shown in the node to which Deep_Plaid is addressing himself.


Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
  1. code
  2. verbatim error and/or warning messages
  3. a coherent explanation of what "doesn't work actually means.

Replies are listed 'Best First'.
Re^4: Given When Syntax
by Deep_Plaid (Acolyte) on Mar 16, 2014 at 16:14 UTC

    Sorry to waste your time, WW. I will be more thoughtful in the future. I do appreciate the time and help I have received from people on this site. I try to do as much research as I can before posting so I don't waste people's time. I am also taking a PERL course through Pluralsite and I haven't gotten through the course yet - real time deadlines have gotten in the way.