in reply to Reading and writing to files: Debrief Question v2
in thread Reading and writing to files
I'll just answer that question, since merlyn has stated often enough that he doesn't have the time to answer all the "easy" questions.
Lines 2 and 3 put those filenames into the @ARGV array, which has the same effect as putting those filenames in the commandline (@ARGV contains all words in the commandline after the name of the called script.) The operator <> reads from all the filenames on the commandline, or from STDIN if there are no filenames on the commandline. So line 2 and 3 actually do read those files into those arrays without needing an open statement. Beautiful!
In line 4, the array @daily is used in a scaler context, since it is compared with a scalar (3). In a scalar context an array returns its length, in this case the number of lines in the file. So you don't need that # operator, although you could use it.
I hope I got that all right, I'm pretty new to perl myself. My compliments to merlyn, that is very short yet very readable code. Perl is beautiful!
Christian
|
|---|