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

Cannot append to system command

Status
Not open for further replies.

Winstonb

Technical User
Aug 11, 2001
29
GB
Trying to append a double quote to a variable. The system command seems to end the line, any ideas on a way round this ?
eg,

$x = `DATE /T` ;
$y = $x.'"' ;
print $y ;

Wanted.....
23/06/2008"

But I get.....
23/06/2008
"
 
There must be a newline character at the end of the output of DATE /T

Either:
a) see if there's a parameter that can be passed to DATE so that it doesn't print a newline; or
b) use the 'chomp' function on $x to remove the newline before creating $y.
 
Ishnid,

Thanks for that, chomp worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top