Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Manipulating Output

by Abigail-II (Bishop)
on Jul 09, 2002 at 14:34 UTC ( #180490=note: print w/replies, xml ) Need Help??


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!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://180490]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2023-02-01 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?