in reply to Re^2: What makes good Perl code?
in thread What makes good Perl code?
One thing I do is to cleanup bulky lines after I get it working. For example, I might use $LOOP = $LOOP +1; until I get comfy and then go back and change that to ++$LOOP;.
In this case, the first thing I noticed was chomp: chomp (my $current = <STDIN>);.
Also, I keep the input and descriptor together.
print "Type the current of the circuit.\n"; chomp (my $current = <STDIN>); print "Now type the resistance of the circuit.\n"; chomp (my $resistance = <STDIN>);
But, really, as long as it's legible and someone can pick this up after you've moved on and edit/use it, you're a step above some people. Keep It Simple, =!Sloppy.
|
|---|