Perl Programming Language
1) Write a Perl script to concatenate "This is String One" and "This is String Two". Print all three strings, one per line with its length.
Output:
This is String One (print length here)
This is String Two (print length here)
This is String One This is String Two (print length here)
2) Write a Perl function that creates an array using qw function with the month names. It then prints the elements 4 and 7 (May & August). It also prints total number of elements in the array.
Output:
May
August
Number of Elements: 12
$s1 = "This is String One";
$s2 = "This is String Two";
$s3=$s1.$s2;
$l1 = length($s1);
$l2 = length($s2);
$l3 = length($s3);
print "$s1 $l1\n";
print "$s2 $l2\n";
print "$s3 $l3";
As per policy we can answer 1 question per post. Please post the remianing questions as separate post.Thanks
Get Answers For Free
Most questions answered within 1 hours.