Sunday, March 1, 2009

learning to use warnings, the hardway

Trying to write to file names instead of file handles by way of typographical error, yes I am a super schmuck! Trying to figure out for at least 5 minutes why the parant isn't getting any output from the child process, and sure enough.... Don't print $filename when you mean print $filehandle, haha! (or better yet, don't use ($lhs, $rhs) and ($lfd, $rfd) for the file names and handles when tired)

Tried running my scratch-file under use warnings, and sure enough the expected warnings poped up. This is what I get for not enabling warnings when writing a function in a separate file for testing crap. Hmm, what was it she said to me years back? Something like "We need to pump some caffeine into you", maybe it's not a bad idea lool.


Rule #1 of Perl, use warnings or die $!
Rule #2 of Perl, use strict or warn $!
Rule #3 of Perl, goto Rule #0


(use what or ... is not actually perl syntax, let a long setting $!, and is infact a compiler error that would have to be trapped in an eval, but hey at this time of morning it works well enough in ascii :-P)

No comments:

Post a Comment