|laziness, impatience, and hubris|
How to use empty "<>" (Diamond Operator) inside While loopby slayedbylucifer (Scribe)
|on Jun 25, 2012 at 08:58 UTC||Need Help??|
slayedbylucifer has asked for the
wisdom of the Perl Monks concerning the following question:
I am not getting "<>" diamond operator right. I want to understand how the "<>" (empty Diamond operator)" works in a "while"loop.
Here is my code ( the script is saved as diamond.pl):
Now i have two files called colors.txt and seasons.txt in the same directory as that of the above script. so if i run below command, it start printing the individual lines of both the .txt files:
and I understand above.
However, If I run below comamnds, it errors out;
I get below eerror:
My undestanding was (and this is mentioned on numerous pages on hte internet), the empty "<>" checks for the @ARGV. So in above command, I was hoping to see the output as one word of the sequence "these are words and not the file names" printed on each line.
I am pretty sure am doing something really dumb here. could you explain how an "<>" (empty) operators works in a while loop. An example of the script and the command would be of great help.