Fun with Perl

Posted on Updated on

I’ve been wanting to learn Perl for a long time but never had the chance. So today after finishing my assignment and a bit of time to spare I decided to have a little fun with it and see just what kind of cool things I can do with it.

This is just a simple for loop inside another for loop to print a 10 by 10 grid. Useful for later if I want to iterate then print out a 2D array.

#!/usr/local/bin/perl
my $count;
 
$count;
$new_count;
 
for ($count = 0; $count < 10; $count++) {
        print $count;
    for ($new_count = 0; $new_count; 10; $new_count++) {
        print $new_count;
    }
    print "\n";
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s