Friday, 16 August 2013

Replace returns with spaces and commas with semicolons in Perl

Replace returns with spaces and commas with semicolons in Perl

This one should be relatively easy for someone who is more familiar with
Perl... I simply want to be able to be able to replace all of the line
returns (\n's) in a single string (not an entire file, just one string in
the program) with spaces and all commas in the same string with
semicolons. Here is my code that is in need of some help...
$str =~ s/"\n"/" "/g;
$str =~ s/","/";"/g;
Thank you so much in advance for helping me and other beginning Perl
programmers figure out how to manipulate strings...

No comments:

Post a Comment