in reply to Re^2: How to Ask a Question (With Test::More) (repost, now with Sitedocclan approval.)
in thread How to Ask a Question (With Test::More)
Quite frankly, I think that in most instances, it is simple better to allow Perl to detect these kind of trivial errors, It most times does a better job of reporting the nature of the problem than the programmer will:
#! perl -slw use strict; sub times7 { return $_[ 0 ] * 7; } print "times7( $_ ) returned:", times7( $_ ) for 1, 2, 3, 0, undef, 'f +red'; __END__ P:\test>junk times7( 1 ) returned:7 times7( 2 ) returned:14 times7( 3 ) returned:21 times7( 0 ) returned:0 Use of uninitialized value in concatenation (.) or string at P:\test\j +unk.pl line 8. Use of uninitialized value in multiplication (*) at P:\test\junk.pl li +ne 5. times7( ) returned:0 Argument "fred" isn't numeric in multiplication (*) at P:\test\junk.pl + line 5. times7( fred ) returned:0
|
---|