[Classiccity-pm] perl curiosity..

Darrell Golliher darrell at golliher.net
Thu Aug 5 09:29:29 CDT 2004


  So I'm reading someone elses code and come acrosse something like
  this..

    @things = qw(one two three);
    print $things[-1];

  Which prints "three".  Actually, the code really looks more like
  this..

  my $updated= localtime((stat $cAr[-1]->source_file)[9]);

  Which really looks ugly to me.  In this example $cAr is an array of
  HTML::Mason components.

  So, I'm wondering if you guys know an alternate idom for specifiying
  the last element of an array.  Indexing it with -1 looks ugly to me.

-Darrell


More information about the Classiccity-pm mailing list