Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Printing line before matching expression

by Anonymous Monk
on Sep 11, 2013 at 07:54 UTC ( [id://1053423]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Printing line before matching expression
in thread Printing line before matching expression

compared to other proposals is the pushing and shifting which involves a lot of copying data around.

Sure it doesn't :)

This can be done more easily by cycling through the buffer using the modulo operator on the line number of the data.

If all the data you want is at the end

my @data = ( undef, undef, qw/ bingo nameo / ); print @data[ -1,-2,-3 ]; __END__ nameobingo

Replies are listed 'Best First'.
Re^4: Printing line before matching expression
by hdb (Monsignor) on Sep 11, 2013 at 08:21 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-03-29 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found