Notes to self
- If one changes a variable, check the whole script for that variable to make sure that the results will be as expected.
- From bart: LA it's often considered good practice to increment the variable in a continue block, to prevent running out of sync when using next.
- Do not print Dumper when trying to display a script in a browser without using <pre> tags.
- Do print Dumper when something goes wrong. The data structure is usually the problem.
- Intrepid: btw, i wish i could explain to a lot of people i know, how efficacious Lady_Aleena's explained strategy can be (to use coding and thinking about coding to master a disquieted state of mind)
- From ambrus: In general, use magic only when normal solutions aren't enough.
- From GrandFather: each time through its loop while asks itself "Can I loop this time? Can I? Can I Can I? Please?" and if the answer is no (false statement) while gets grumpy and stops
- rename will not create directories, be sure to use mkdir in conjunction with rename if the files are also being moved to a new directory.
Things I should get a grip on
- objects
- testing
- SQL
- version control
Current code
use strict;
use warnings;
Silly (and incomplete) code
use strict;
use warnings;
my @courses = qw(salad fish entree oyster dessert);
if (@courses > 3) {
my @last = splice(@courses,3,-1);
my @forks = map { "$_ fork" } @courses;
my @knives = map { "$_ knife" } reverse @courses;
my $last = grep { /oyster/ } @last ? 'oyster fork' : '';
print 'napkin '.join(' ',@forks).' plate '.join(' ',@knives).' spoon
+ '.$last;
}
|