> -----Original Message----- > From: Chad Kellerman [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 19, 2002 11:18 AM > To: [EMAIL PROTECTED] > Subject: newbie question > > > Hello, > > I have only been writing perl for a few months, so forgive > me if this > sounds stupid.
No, it's an excellent question. > > what is the difference between: > > $| = 1; > and > $|++; The first assigns the value 1 to the variable $| The second increments (adds 1 to) the current value of $| $| is a "special" variable to Perl. It controls the automatic flushing of output filehandles after a print(). The default is 0, which means no auto-flush. Setting it to 1 (or any non-zero value) enables the auto-flushing. Assuming these statements appeared at the top of the program, the effect would be the same for each. I prefer the first form to the second, since it is not dependent on what other code may or may not be doing to $| (i.e. consider if $| were -1 prior to the increment). > > Or can you point me in the right direction on where I can read > boutit? perldoc perlvar explains the "special" variables like $| perldoc perlop explains the operators like ++ HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
