
Laurent_R
Veteran
/ Moderator
Nov 19, 2017, 11:18 PM
Post #3 of 4
(4892 views)
|
Re: [tester_V] Need to reomve leading whitespace
[In reply to]
|
Can't Post
|
|
When your program misbehave, goes nuts or fails, very often, it is because your variable don't contain what you think. One basic debugging technique is to take the habit to print the contents of your variables. For this you can use a debugger, but there are some other very basic ways. To really know the content of a variable (say $foo) just add a print statement like this to you code: This way, if your program prints: you know that you have an unexpected trailing end of line character or leading white space. For variable containing more complicated things such as arrays, hashes of other data structure, use the Data::Dumber module (which is core, so should be available on any Perl install).
|