in reply to Inheritance and IO
I suggest having a look at "perldoc overload" for more information.use overload '<>' => sub { return shift @{shift()}; }; my $obj = bless [ "hello", "world" ]; while ( defined( my $line = <$obj> ) ) { print "it says: $line\n"; }
Update: Expanded my example code
According to the documentation, using the overloaded operator in list context (as you intend to do) is not really supported.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inheritance and IO
by casiano (Pilgrim) on Jul 22, 2007 at 12:03 UTC |