in reply to Re^2: Logical Not and arguments to grep
in thread Logical Not and arguments to grep
The comma operator is useful in other ways..see the command loop I coded at Re: Storing 10 numbers in array. In the statement,
The comma operator allows this to be a single statement.while ( (print "$prompt: "), $number = <STDIN> ) {...}
into the while() conditional. But this statement which uses the comma operator is ok. The "truth or falseness" of the statement is decided by the last clause (the input of the data - not the return value of the print which will be a "1"). Note the paren's are required.print "$prompt"; $number = <STDIN>;
By doing it this way, a re-prompt happens automatically at every loop iteration without having to code the prompting statement within the loop (and having a standalone initial prompting statement before the loop to get things started).
|
|---|