in reply to Re: Determining presence of odd number of hash elements, other syntax problems
in thread Determining presence of odd number of hash elements, other syntax problems

Just do: perl -w /path/to/script.pl

The problem is that the warnings of Use of uninitialized value in string at... and Use of uninitialized value in concatenation (.) or string at... are quite overwhelming with uninitialised variables. The reported location is often many kilobytes of distance away from the actual error.

$ cat test-w
#! /usr/bin/perl

use strict;
use warnings;

my %hash = (
    fred => {
	qw( odd number of elem ents ),
    },
);
$ perl -wc test-w
test-w syntax OK
$ perl -we "require qq{test-w}"
Odd number of elements in anonymous hash at test-w line 6.

Is there a way to turn those uninitialised warnings off on the command line?

Replies are listed 'Best First'.
Re^3: Determining presence of odd number of hash elements, other syntax problems
by Corion (Patriarch) on Jul 20, 2011 at 11:06 UTC
      Is there a way to turn those uninitialised warnings off on the command line?

      Yes, but I mean something like this (except actually working): perl -we 'use warnings;no warnings q{uninitialized}; do qq{$file}'