Re: simple question

On May 31, 2006, at 6:55 AM, Beast wrote:

How do I get last(max) index of SimpleList data?

Normally.  :-)

With a normal array, it's

  @ary   =>   $#ary

with an array reference, it's

   @$aryref  =>  $#{ $aryref }  or  $#$aryref

with SimpleList's tied list, it's just the same, but the syntax is pretty ugly because of what you have to do to dereference the array:

    @{ $slist->{data} }  =>   $#{ $list->{data} }

Other ways include:

    scalar (@{ $slist->{data} }) - 1


    $slist->get_model->iter_n_children (undef) - 1

Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we.
  -- President George W. Bush

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]