CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [psr] taking alternate values from textfile: Edit Log



BillKSmith
Veteran

Apr 25, 2013, 5:33 AM


Views: 1034
Re: [psr] taking alternate values from textfile


Code
use strict; 
use warnings;
use v5.14.0;
while (<DATA>){
print $_, "\n", s/(\d+)\D+(\d+)\D+(\d+)/$1+$2+$3/er, "\n";
<DATA>; # Skip blank line
}
__DATA__
1 2 4

5 6 7

8 9 10


UPDATE: Added use version to code.
Good Luck,
Bill

(This post was edited by BillKSmith on Apr 29, 2013, 5:42 AM)


Edit Log:
Post edited by BillKSmith (Veteran) on Apr 29, 2013, 5:42 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives