in reply to Re: Why does "flush filehandle" work? (indirect object)
in thread Why does "flush filehandle" work?
print $filehandle "Hello world"; is an everyday use of indirect object notation (same with say)
No it's not. print is not a method. This is not a method call, direct or indirect. print is an operator. Same goes for say, grep, map and sort. The lack of comma after their first operand does not make these method calls.
There is no flush operator, though. flush $filehandle is truly a method call (even though the handle might not be an object). To use flush, IO::Handle or IO::File (depending on the version of Perl) first needs to be loaded to provide the method (although newer version of Perl automatically load IO::File when needed).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Why does "flush filehandle" work? (indirect object)
by LanX (Saint) on Jan 29, 2025 at 22:40 UTC | |
by etj (Priest) on Jan 30, 2025 at 00:12 UTC | |
by ikegami (Patriarch) on Jan 30, 2025 at 03:06 UTC | |
by LanX (Saint) on Jan 30, 2025 at 11:21 UTC | |
by etj (Priest) on Jan 31, 2025 at 02:25 UTC |