|
|
| Don't ask to ask, just ask | |
| PerlMonks |
Re^2: Can't understand function returning undefsby rg0now (Chaplain) |
| on Sep 24, 2010 at 20:43 UTC ( #861880=note: print w/ replies, xml ) | Need Help?? |
|
Thanks. Not that I like this behavior but I think I'll have to live with it. But if we are at it. My problem is that I have a function that returns two values when data is available to it and when no data remained it returns undef. What I would like to do is to call this function in a while until all data is consumed. I tried to do this first by which failed due to the above reasons (i.e., the while block always executed since ($x, $y) = recv_data always evaluates to true even if the function returns undef). I still have the option to write but I fail to see this as elegant. How to organize this code so that I obtain the required behavior in an elegant and readable way?
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||