in reply to Why does "flush filehandle" work?
A tool to use to figure out what is going on is Deparse. It shows you how perl interprets the code you give it. It comes with your perl. Here is an example of using it that demonstrates your question.
First, a full script that contains the syntax referenced:
$ cat flush.pl use warnings; use strict; open(my $fh, '> /dev/null'); flush $fh;
Now, tell perl to parse the code and show you its interpretation of it instead of running it:
$ perl -MO=Deparse flush.pl use warnings; use strict; open my $fh, '> /dev/null'; $fh->flush; flush.pl syntax OK
Note how it changed the flush $fh; to $fh->flush;
This demonstrates the "indirect object notation" that others are providing information about.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Why does "flush filehandle" work?
by LanX (Saint) on Feb 04, 2025 at 17:00 UTC |