Re: counting scalar array elements question

2006-03-09 Thread Hans Meier (John Doe)
John W. Krahn am Donnerstag, 9. März 2006 03.36: Hans Meier (John Doe) wrote: [...] my @array; #or: my @array=(); [v--- this sidenote is wrong] (sidenote: the second form must be used in contexts where the code is persistent/preloaded and used several times, to ensure that @array is

RE: counting scalar array elements question

2006-03-08 Thread Timothy Johnson
You need to dereference your array ref. my $count = @{$var}; Or in some circumstances it might make more sense to explicitly use scalar context: my $count = scalar @{$var}; -Original Message- From: Graeme McLaren [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 3:57 PM

Re: counting scalar array elements question

2006-03-08 Thread Hans Meier (John Doe)
From: Graeme McLaren [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 3:57 PM To: beginners@perl.org Subject: counting scalar array elements question Hi all, I have an array question: If I have a variable, $var, and it contains an array how would I be able to easily

Re: counting scalar array elements question

2006-03-08 Thread John W. Krahn
Hans Meier (John Doe) wrote: From: Graeme McLaren [mailto:[EMAIL PROTECTED] If I have a variable, $var, and it contains an array how would I be able to easily count the number of elements in the array? I've tried creating a new array and pushing the original array on to it but that creates