Perl Bugs and Comments

tchrist at sushi.UUCP tchrist at sushi.UUCP
Thu Feb 25 04:25:00 AEST 1988


I've compiled perl after applying all 22 of Larry's patches, and have
written a few programs that use it.  In the course of these programs,
I've discovered several possible bugs and probably peculiarities.  I'm
going to outline them here for discussion, as some may well not be bugs.
First, though, I want to say that I *like* perl.  It's something I've
wanted for a long time, and I sincerely want to take my hat off to
Larry for it.  So don't take these as gripes, but constructive
comments.


A pair of bugs:

A) $! is always 25 (ENOTTY), regardless of what I've just done.
   The documentation says it should contain "the current value 
   of errno, with all the usual caveats".  I think I understand how
   things interract with errno, but I can't explain this one.

B) Certain kinds of variable references misbehave when imbedded in a
   string:

	"this $#ARGV in a string" prints "this ARGV in a string" 
	"this $_[$i] in a string" prints "this <whole line>[i] in a string" 

   where <whole line> is the current input record; others are literals.


Now for some things that are sadly lacking:

1) There is no perror() mechanism.  I would like to be able to say 
	die "$file: $SYSERR[$!]" unless open(fd,$file);
	
2) There is no mechanism for internal file globbing.  Saying
	@manfiles = split(' ',`ls /usr/man/man?/$arg.* 2> /dev/null`);
   is such an overkill -- plus I must check $? as the bourne shell
   returns the unglobbed string if it makes no match.

3) It would be nice if $ENV{'SHELL'} would be honored for `evals`.

4) There is no mechanism for "if" tests, like -e, -x, -w, -d, ...
   Using the `eval` mechanism is clumsy, inefficient, and sometimes
   impossible.  For example, 

   if ( `if [ -e a* 2> /dev/null ]; then echo 1; fi` ) {

   will succeed for just ONE a* file, not zero or more than one.

5) I wish I didn't have to use two statements for this:
	$hours = $_[3];
	$hours =~ s/:.*//;
   I would like to say 
	$hours = $_[3] =~ s/:.*//;
   but in this context, perl says it's is a pattern-compare and returns
   one or zero.

6) You can link but not symlink; if you're a BSD system this should be
   possible.

7) I've had trouble with the array/scalar notation, as well as not
   always being certain whether to use a $ or @ at all.  I've always 
   worked it out, but it's somehow not very intuitive.  Has anyone else
   had this problem?



More information about the Comp.sources.bugs mailing list