Reputation: 307
I've two perl scripts, both of them wait for user to enter some input as below,
Does both of them are same ? Does "STDIN" written in <> are just to for user-readability of code ? If not please tell me the differences.
a) $in = <STDIN>;
b) $in = <>;
Upvotes: 5
Views: 389
Reputation: 1102
More information about <>
you can get from perlop, section about I/O Operators
Upvotes: 0
Reputation:
The form <FILEHANDLE>
will only read from FILEHANDLE
.
The form <>
will read from STDIN
if @ARGV
is empty; or from all the files whose names are still in @ARGV
which contains the command line arguments passed to the program.
Upvotes: 13