Perl Programming Question:

Download Job Interview Questions and Answers PDF

How to concatenate strings with Perl?

Perl Programming Interview Question
Perl Programming Interview Question

Answer:

Method #1 - using Perl's dot operator:
$name = 'checkbook';
$filename = "/tmp/" . $name . ".tmp";

Method #2 - using Perl's join function
$name = "checkbook";
$filename = join "", "/tmp/", $name, ".tmp";

Method #3 - usual way of concatenating strings
$filename = "/tmp/${name}.tmp";

Download Perl Programming Interview Questions And Answers PDF

Previous QuestionNext Question
What is the easiest way to download the contents of a URL with Perl?How do I read command-line arguments with Perl?