Are You a Java Expert? Test Your Knowledge With These Four Tricky Questions
Even though Java was designed to be an easy-to-use programming language, it still has many traps and surprises for the unwary. In this article I ask grill you on four slightly lesser-known aspects of Java that may trip you up … Continue reading
Perl Base64 — How To Do Base64 Encoding in Perl
You can do base64 encoding in Perl using the MIME::Base64 module. For those who don’t know, base64 is a way of encoding binary data in ASCII characters; so you can email your favorite program as text, if you want to … Continue reading
Perl — Size of an Array
To find the size of an array in Perl, simply use the array in a scalar context. my @items = (“apple”, “orange”, “banana”); my $size = @items; print “Array contains $size items.\n”; Learn Perl By Doing It Get the complete … Continue reading
Perl Foreach — Looping With Foreach in Perl
The foreach keyword is probably the easiest and most often used looping construct in Perl. Use it for looping through the items in an array. my @items = (“apple”, “orange”, “banana”); foreach my $item(@items) { print “$item\n”; } apple orange … Continue reading
Perl Clear Array
How Do I Clear An Array in Perl? To empty an array in Perl, simply define the array to be equal to an empty array: # Here’s an array containing stuff. my @stuff = (“one”, “two”, “three”); @stuff = (); … Continue reading
Perl Concatenate: Joining Strings and Arrays in Perl
Concatenating Strings In Perl Concatenating strings in Perl is easy. The only thing to remember is that you have to use the dot operator, not +: my $string1 = “Nice”; my $string2 = “weather”; my $string3 = “today”; my $string4 … Continue reading