![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
Re: return more than 1 valueby Utilitarian (Vicar) |
on Jul 29, 2010 at 08:38 UTC ( [id://851882]=note: print w/replies, xml ) | Need Help?? |
Hi changma_ha,
There are a few issues in your code, as pointed out above you can only return from a subroutine once so the second return is meaningless. However if you return two arrays they are "flattened" and become indistinguishable. Take a look at the return documentation As a result you should return references to the two arrays (or other data structure) I have provided you with a code sample with comments which should make things clearer, play about with it and feel free to ask if you don't follow what it is doing.
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
In Section
Seekers of Perl Wisdom
|
|