Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Print all lines in a file except the last two

by Jasper (Chaplain)
on May 20, 2004 at 15:50 UTC ( #354985=note: print w/ replies, xml ) Need Help??


in reply to Re: Print all lines in a file except the last two
in thread Print all lines in a file except the last two

Why a counter and imply it's short when you have a foreach, and a print"$_" ?

print for@f[0..-2] is shorter.

Edit: Wow, I really do live in a little fluffy bunny world where everyone's happy, there's no war, pizza isn't fattening, Darth Vader was never an annoying child, the Six million Dollar Man really was a good tv show, new shoes are comfy, my girlfriend's bum never looks big in this, and code like this works.

Kind of surprised I didn't lose all the xp I'd ever gotten on this one. hardburn posted the correct code below.


Comment on Re: Re: Print all lines in a file except the last two
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-05 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls