Jonathan's Corner
(Search & Sitemap)
> Writing >
Miscellaneous Nonfiction >
Tinkering with Perl
Skip Back
Previous
59
60
61
62
63
64
65
66
67
68
Next
Skip Forward
Printer-Friendly Version
When you concatenate two strings, you stick them both together, one after the other. For example:
If you concatenate:
"Old MacDonald had a farm. "
and
"On that farm, there was a cat. "
the result is,
"Old MacDonald had a farm. On that farm, there was a cat."
In Perl, you can concatenate strings by placing a period ('.') in between them. The following code assigns $first_part the value "Old MacDonald had a farm.", $second_part the value "On that farm, there was a cat. " before assigning the concatenated value to $combined:
$first_part = "Old MacDonald had a farm. "; $second_part = "On that farm, there was a cat. "; $combined = $first_part . $second_part;
Tinkering with Perl is a free book that provides an introduction to programming in Perl, as well as a basic reference for things like foreach in Perl, if-then, and if-then-else, in addition to providing a glossary where you can find definitions for concatenate and other terms.
Tinkering with Perl may be one of the most popular offerings on this site, but it's not the only attraction. You can read a tongue-in-cheek Game Review: Meatspace, read an even more offbeat customer service survey (whether or not you actually fill it out), and spend a few minutes wishing your boss would read, The Administrator Who Cried, "Important!" (Not to mention that there are other things you can read here besides tech stuff, from Janra Ball: The Headache to The Spectacles.)
Jonathan's Corner
(Search & Sitemap)
> Writing >
Miscellaneous Nonfiction >
Tinkering with Perl
Skip Back
Previous
59
60
61
62
63
64
65
66
67
68
Next
Skip Forward
Printer-Friendly Version