Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Finding the last statement in string of atmost similar pattern

by hdb (Monsignor)
on May 06, 2013 at 07:29 UTC ( #1032201=note: print w/replies, xml ) Need Help??


in reply to Finding the last statement in string of atmost similar pattern

So you want the last non-empty line in your file? I am using a string instead of your file.

use strict; use warnings; my $string; # replacement for your file $string .= "abc($_) = xyz(".($_-1).");\n" for 1..10; my $line; for ( split /\n/, $string ) { $line = $_ if $_; } print $line,"\n"; # alternatively print +(split /\n/, $string)[-1],"\n";
  • Comment on Re: Finding the last statement in string of atmost similar pattern
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032201]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2017-09-22 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (261 votes). Check out past polls.

    Notices?