On Tue, 22 Jul 2003 03:48:53 +0200, [EMAIL PROTECTED] wrote: > >Could someone please explain what is happening here? >I came across it, and had a hard time trying to figure out what was >going on.
When you use an array in scalar context (e.g. scalar(@ARGV)==foo, or even just @ARGV==foo), it gives the number of elements in the array (either 2 or 3 in your examples). When you use a comma-operator in scalar context (e.g. (2,3)) it throws away the left operand and returns the right one. qw() should act just like a comma'd list, so scalar(qw(2 3)) should be 3. You aren't seeing this, so I suspect you to be using an extremely old version of perl where qw() didn't work as well. If you upgrade to 5.005_55 or higher you should see qw() acting better.
