I'll grant you it is sort of weird. I think that's a perl thing, we just copied how they did it.
undef is both a function and a (non) value. It is the main reason Little never got pushed back into tcl, the tcl crowd hates the idea that there can be a value for a variable that is undefined. I found that very useful, for example, undef is the error return from any function. Just made sense to me, didn't make sense to the Tcl people.
It's not a Perl thing. In Perl, that would set argv[1] to undef. It would not delete or left-shift @ARGV. There is a delete() function that acts similarly, but is discouraged to use on regular arrays. Shift() would be more appropriate in this case.
Given the context, in little-lang, it appears to delete argv[1] and shift all of the right of that down, such that argv[2] becomes argv[1] and so on. That's so that the the "while (buf = <>)" construct used right below it doesn't process the regex as if it were a file to "grep" through.
In Perl, you would typically do it this way...
if (!defined(my $regex=shift(@ARGV))) {
die("usage: grep regexp [files]");
}
undef is both a function and a (non) value. It is the main reason Little never got pushed back into tcl, the tcl crowd hates the idea that there can be a value for a variable that is undefined. I found that very useful, for example, undef is the error return from any function. Just made sense to me, didn't make sense to the Tcl people.