Re: Understanding list and scalar context

2016-09-18 Thread khalil zakaria Zemmoura
Thanks Gil, that helped me to understand the context of the code presented in the book. Le 18 sept. 2016 18:02, "Gil Magno" a écrit : > Hi Khalil > > 'say' creates list context. So if 'say' receives the list ('one', 'cd', > 'qw') it will print 'abcdqw'. > > 'reverse' creates list context. So if

Re: Understanding list and scalar context

2016-09-18 Thread Gil Magno
Hi Khalil 'say' creates list context. So if 'say' receives the list ('one', 'cd', 'qw') it will print 'abcdqw'. 'reverse' creates list context. So if 'reverse' receives the list ('ab', 'cd', 'qw') it will return a list with the same elements, but with its order inverted ('qw', 'bc', 'ab'). The c

Understanding list and scalar context

2016-09-18 Thread khalil zakaria Zemmoura
Hi everyone, I'm reading the modern perl book and I have some questions to address about scalar and list context. Here is the code that I want to understand. while (<>) { chomp; say scalar reverse; } Where I'm struggling is : say scalar reverse; The book says that 'say' impose list context to