RosAng
RosAng

Reputation: 1050

Concatenate of string in perl

i am trying to concatenate string in perl.

eg:

my $file = $table_name.".sql";
print $file;

I get output like:

Employee
.sql

(considering $table_name =Employee )

please suggest how to make sure the output comes in single lie without blanks.

Upvotes: 0

Views: 603

Answers (2)

Ahmed Elazab
Ahmed Elazab

Reputation: 21

The chomp() function will remove newline character from the end of a string. check http://perlmeme.org/howtos/perlfunc/chomp_function.html

Upvotes: 1

John C
John C

Reputation: 4396

Your $table_name variable contains a word 'Employee' as well as a new line character. You can use chomp to remove the newline.

Add this before you concatenate your variables:

chomp $table_name;

Upvotes: 5

Related Questions