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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a quick question about escaping characters 2

Status
Not open for further replies.

keak

Programmer
Sep 12, 2005
247
CA
I have a file that prints a variable to another file like so.

Code:
open (OUT, ">profile_serv") || die ($!);

$line = <IN>;
while ($line) {
    chop($line);
    print OUT ("su$line04");
}

basically I want to append '04' right after the variable's value (without a space).


I tried (say if $line=="User1")
Code:
print OUT ("su$line\04");
which gave me "suUser1^D"


and
Code:
print OUT ("su$line\04");
which gave me "suUser1\04"

what I am trying to get is "suUser104" as the output of the script.

Does anyone know a way around this?

regards
 
Thanks that works for what I need to do,
but just out of curiosity, is there a way around this (escape sequence) that does it all in the double quotes ?
 
Thanks for the quick reply as always guys.
Appriciated!
 
there is no way around tacking alpha/numeric characters onto the end of a variable name without some type "escaping" involved. I used concatenation because most people are familiar with it, Tony used a method I have seen on occasion but am not very familiar with.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top