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

Can you advice something to read on the errors i keep on getting, like uninitialised or sometimes global variable and all

Replies are listed 'Best First'.
Re^8: Printing first and last line
by Athanasius (Archbishop) on Aug 14, 2012 at 17:01 UTC

    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