Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command opposte of \n 1

Status
Not open for further replies.

JaySang

Technical User
Jun 26, 2003
43
0
0
CA
Is there such a command that will remove a line from a varibale ?
 
chomp ?
Code:
$string = "foo\n";
chomp($string);
Cheers, Neil
 
but what is you had a $string = "Foo\nFoo2"; and you wanted to remove the new line between
 
Code:
$string = "Foo\nFoo2";
$string =~ s/\n//g;
Cheers, Neil
 
If you are working with a Windows OS file, then you might need to remove the \r (Carriage Return) as well as the \n (New Line).

Here is the expression:
Code:
s/[\n\r]//g


Michael Libeson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top