in reply to Overloading for List Context
I can make it work with while. I'm just a monkeyboy, so I have no idea why it works. Anyways:
package main; my $quux = LuckyDeck->new(0..9); print 'List Context',$/; while (<$quux>) { print $_; } print $/;
Or, putting the while in the same style as the rest of the program:
print while <$quux>;
Would somebody smart like to explain why while works, but for doesn't?
Update: Drank some more coffee, realized that wasn't really the question. Back to the drawing board ...
Update: Okay, I am stumped (which isn't a major news item itself ;-) ). I have found no way to convince LuckyDraw that I wantarray. List assignment and while both come up in a scalar context. Where is the oddity coming from? Overload? The iterator <> operator? Does perl have a hangover today?
"All you need is ignorance and confidence; then success is sure."-- Mark Twain
|
|---|