in reply to Re^7: Printing first and last line
in thread Printing first and last line

It is useful to begin every script with:

use strict; use warnings; use diagnostics;

The diagnostics pragma puts extra information into warning messages, which can help in figuring what the warnings are really about.

As a rule, concentrate on the first error or warning message and fix it. Often, this will fix the other warnings or errors too.

Here are some helpful references:

“Uninitialised” warnings generally mean your variables don’t contain the data you think they do. Get in the habit of printing out the contents of variables. Here is an easy way:

use Data::Dumper; my %hash; # Fill %hash with data print Dumper(\%hash);

Data::Dumper is a core module, so you have it already. See Data::Dumper for more information.

That’s the best advice I can think of at the moment. Hope it helps,

Athanasius <°(((><contra mundum