C. Abney cabney at
Fri Mar 10 16:01:24 CST 2000

Just let me know if I'm a pain...

I was playing with error output in one of my scripts today, and here's
what I found:  Perl does pretty much what you expect.  Go figure.

This isn't always the case as I once found out (using something lame
like: "$opt_D ? $DEBUG = 1 : $DEBUG = 0;") but it was possibly worth it
because how often does one get email from Tom Christiansen and Uri
Gutman? <g>

Well I learned (a little bit, anyway) to read and test my assumptions
since then, and can test things like the following:

I have a line of code:

	system ( "$cmd" ) == 0
		or warn "failed remote copy: $!" unless $QUIET;

but I'm so brain dead that knowing 'or' is evaled left to right
isn't enough for me to be sure that its low precedence won't be
trumped by that of the 'unless'.  Too, 'unless' isn't listed in
the list of operators in which their precedence is scaled against
each others (that's 'perldoc perlop'.)  I had to test it.  I used
the following script:

	(2)[2136]$ cat
	#! /usr/bin/perl
	$FOO = shift;
	$ERR = shift;
	$ERR or warn "gah!\n" unless $FOO;

Which, when executed, prints (or doesn't) the following:

	(2)[2136]$ ./ 1 1
	(2)[2136]$ ./ 1 0
	(2)[2136]$ ./ 0 1
	(2)[2136]$ ./ 0 0

Unless I interpreted it wrong, I would have gotten a warning in the
second test if the 'unless' took precedence.  And I shouldn't have
had /any/ warnings in the third and fourth tests.

But... just ignore this.  I'm really just a overly chatty Perl

Einstein himself said that God doesn't roll dice. But he was wrong. And
in fact, anyone who has played role-playing games knows that God
probably had to roll quite a few dice to come up with a character like
Einstein.  -- Larry Wall                                     C. Abney


The posting address is: san-diego-pm-list at

List requests should be sent to: majordomo at

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at> .
This is the general rule for most mailing lists when you need
to contact a human.

More information about the San-Diego-pm mailing list