December 2013 Archives

Subroutine Calling Conventions

Hello everyone.

In trying to find places that I might be able to exchange links to get traffic to my tutorial site, I found an article about how one should determine if a tutorial is good. One of the things that they mention is that a tutorial that teaches

&subname()

as a valid subroutine calling convention is out of date. It continues to explain that this does do something, but not what people think it does.

As a matter of fact, I just finished writing a major tutorial on subrou…

Change Counting Problem - Feedback Requested

There's a common programming challenge where you write a program to take a dollar amount from the user, and then return the simplest way to create that amount with only coins (using the fewest coins possible). I took a crack at this a while back, and I would like to know if there are ways it could be improved or if you would have done it differently.


use strict;
use warnings;
 
print "Input a dollar amount: ";
my $amount = readline STDIN;
chomp ($amount);

$amount = $amount * 100;
$amount = sprintf($amount);

my $quarter = 25;
my $dim…

About Chris K

user-pic I'm a student teaching himself Perl and want to learn more.