in reply to Manipulating Output

print FILE (split /:/ => $_) [-1], "\n";
Question: why do you open the file in each iteration? Opening it once is more efficient.

Abigail

Replies are listed 'Best First'.
Re: Re: Manipulating Output
by Anonymous Monk on Jul 09, 2002 at 15:32 UTC
    thanks. Sorry I only gave just a small portion of my script and you answered my question. Now that it works can you please explain how this works???? I am lost on the => and the [-1] parts.

    print FILE (split /:/ => $_) [-1], "\n";
      => is a fancy comma, and [-1] takes the last element of the list preceeding it.

      Abigail

        Abigail and all others who replied:
        Many thanks for your quick answers!!