Hello,

I'm learning Perl for fun and writing a little program as a learning
exercise.  I've spend the last few years writing Java middleware and I'm
finding Perl to be extremely refreshing.  There are so many things you can
do in Perl that would take many lines of code in Java.  For example: @new =
@old[3..8];  Or, ($this, $that) = @old;

Anyway, I'll be posting my curiosities from time to time.

I'm wondering, why can I do this:

    local @fileList = reverse sort `ls $list*.list`;
    local $current = $fileList[0];
    local $previous = $fileList[1];

    chop $current;
    chop $previous;

But, not this:
    local @fileList = reverse sort `ls $list*.list`;
    local $current = chop $fileList[0];
    local $previous = chop $fileList[1];

As a side note, I think it's great that I can do this (although I find it
difficult to read, for now):

    local ($current,$previous) = (reverse sort `ls $list*.list`)[0,1];

    chop $current;
    chop $previous;

Of course, I know there has to be a better way to do this:
reverse sort `ls $list*.list`

I just get tired of looking everything up in my Perl book.

David Blevins


Reply via email to