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 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 an array of arrays.

Basically I have:

my $var = [
                'a',
                'b',
                'c'
              ]


and I tried:

push @array, $var;


and got:

@array=[

               [
                  'a',
                  'b',
                  'c'
               ]

         ]

Using my original array which is assigned to scaler, what I need is:

@array = [
               'a',
               'b',
               'c'
]


So I can do:

my [EMAIL PROTECTED];


Can anyone shed any light on this or suggest a better way of doing this?



Cheers,

G :)


Public Sub House()

On Error Resume drink

        If Pint.empty = True Then
                Pint.refill
  Else
                Pint.drink
        End if

stomach.add Pint

MsgBox " I've had .... " & stomach.count & " Pints"
MsgBox "VERY DRUNK"

End Sub



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to