[Israel.pm] Selective warnings use

Madani, Srikanth, VF-DE Srikanth.Madani at vodafone.com
Wed Feb 9 05:55:12 PST 2005

Thanks for the reply, Shlomo.

Direct use of the $] variable isn't possible because of different
floating point implementations (as the documentation is kind enough to

But then I tried the suggested:
	printf "version is v%vd\n", $^V;

which works fine on Linux/Perl 5.8.

The same code fails on Solaris/Perl 5.005_03. (which, I just found out,
is actually v5.5! - see

Invalid conversion in printf: "%v" at ./war.pl line 5 (#1)

    (W) Perl does not understand the given format conversion.
    See perlfunc/sprintf.

As lower versions of Perl don't support the so called vector flag in
sprintf, it's a bit of a Catch22 situation!

So, I guess the solution is to:

A) Always use the "-w" switch.
B) While running on a version which supports the warnings pragma, use it
- this disables the effects of the global "-w" switch.
C) Else, remove the statement "use warnings;" from your code.

Reference link:
http://search.cpan.org/~nwclark/perl-5.8.6/pod/perllexwarn.pod - section
on "Backward compatibility"

Srikanth Madani

More information about the Perl mailing list