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 = <>;
                $@ The Perl syntax error or routine error message from the last eval, do-FILE, or require command. If set, either the compilation failed, or the die function was executed within the code of the eval.
On Win32 systems, if you double-click on the icon for the Perl executable, you'll find yourself in a command-prompt window, with a blinking cursor. You can enter your Perl commands, indicating the end of your input with CTRL-Z, and Perl will compile and execute your script.
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.
<> is shorthand for <ARGV>. And ARGV is a special filehandle that either opens and iterates through all of the filenames specified in @ARGV (the command-line arguments) or gets aliased to STDIN (when @ARGV is empty).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With