Joel wrote:

> Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the
> same really.
>
> Joel

Looks good!  I like the logic overall.  I think that once you get your hands on some
better syntactic tools, you will be flying right along.  You have a bit of reading to
do to really get a good grounding in Perl:

perldoc perlsub
perldoc perlreftut
perldoc perlref
perldoc perlstyle

Would make a good basic set to start with.  Some tips from what I see in your code:

Upper case should be limited to certain special identifiers.  Some system variables
and filehandles use uppercase, and global constants.  otherwise, it is good to avoid
it.  Generally, we use choo_choo_style for identifiers in code, and CamelBack for
package [class] names.

Closing braces work best aligned vertically with the beginning of the line that
controls the block:

for my $count (1..50) {
   my $thing = get_thing($count);
   until ($thing->done) {
      $thing->next_things_specialty();
   }
}

This way, you can always look directly up from a closing brace, and see where  the
block began. This helps to quickly register the scope of the block.  Likewise, it is
good to adopt a standard indent, and to always indent the lines within a block by one
increment.  My personal preference is two spaces, but I usually use three spaces for
example code.  Whatever passes the arms-length test.  Just be consistent within any
project.

Once you get used to the way we define subroutines in Perl, and and to passing
arguments to these subs, by value and by reference, you can probably look at your code
and see the places where you can take an inner loop and branch it off into a clearly
named function.

Welcome to Perl.  It is a language which can support a very natural and transparent
coding style.  Make the most of it!

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to