<?xml version="1.0" encoding="windows-1252"?>
<node id="998515" title="subroutine function" created="2012-10-11 14:58:23" updated="2012-10-11 14:58:23">
<type id="115">
perlquestion</type>
<author id="994288">
truthseeker66</author>
<data>
<field name="doctext">
&lt;p&gt;Dear Monks, &lt;br&gt;&lt;br&gt;

1. '$first' and '$second' are 2 different variables. Why is &lt;br&gt;'$_[0] . $_[1]' used instead of '$_[0] . $_[0]' to combine &lt;br&gt;two strings? Doesn't the first '$_' for '$first' and the &lt;br&gt;second '$_' for '$second'? &lt;br&gt;&lt;br&gt;

2. In this code " . $_[0] . $_[1] . "\n"; I understand why there &lt;br&gt;are two dots. But I don't understand why the third dot is &lt;br&gt;there. &lt;/p&gt;

Thank you,   

&lt;code&gt;
#!/usr/bin/perl

#prompt user for two strings. Remove newline and 
#store into variables
print "\nEnter the first string: ";
chomp($first = &lt;STDIN&gt;);
print "\nEnter the second string: ";
chomp($second = &lt;STDIN&gt;);

sub combine{
print "\nThe combined strings are: " . $_[0] . $_[1] . "\n";
}

&amp;combine($first,$second); &lt;/code&gt;

&lt;p&gt;
C:\JPARK\JPERL&gt;sub-ex.pl &lt;br&gt;

Enter the first string: I go &lt;br&gt;

Enter the second string: to school. &lt;br&gt;

The combined strings are: I go to school. &lt;/p&gt;</field>
</data>
</node>
