Is there an equivalent to Perl’s $_ function? I’m rewriting some old perl scripts in C# and I never learned any perl. Heres an example of what i’m trying to figure out
sub copyText {
while($_[0]){
$_[1]->Empty();
$_[0] = $_[1]->IsText();
sleep(1);
}
First of all,
$_is not a function. It’s just an ordinary variable (that happens to be read and changed by a lot of builtins).Second of all, the code you posted does not use
$_. It’s accessing elements of@_, the parameter list.A more more readable version of the code you posted would be:
Emptyand one namedIsText.Sorry, I don’t know C#, but hopefully you can move on with this.