in reply to Subroutine & For loop
Here's a trivial example:
sub doit { my ($arg1, $arg2) = @_; print "$arg1 squared is $arg2\n"; } for (0 .. 10) { doit( $_, $_*$_); } [download]
...roboticus
When your only tool is a hammer, all problems look like your thumb.