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: Beginner: Re: [joseph4325] substitution question: Edit Log



BillKSmith
Veteran

Jun 11, 2013, 10:10 AM


Views: 703
Re: [joseph4325] substitution question

A very different approach. (My FORTRAN is showing)

Code
use strict; 
use warnings;
foreach my $line (<DATA>) {
chomp $line;
$line =~ s/([01])\s*$/1-$1/e;
print $line, "\n";
}
__DATA__
(string),0
(string),1
1
0
this is a string,1


UPDATE: Removed unnecessary code.
Good Luck,
Bill

(This post was edited by BillKSmith on Jun 11, 2013, 10:12 AM)


Edit Log:
Post edited by BillKSmith (Veteran) on Jun 11, 2013, 10:12 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