D
David
I can't count how many times I've wanted to write a statement like
this:
if ($val in @vals){
# do my stuff
}
Does anyone know of a way to cause a sub call to recieve the
scalar preseeding the sub call as well as the array following?
Essetialy I want to create a keyword called in which checks to see if
a list contains a certain value.
Yes I know I can use something like
my $in = $val eq $_ ? 1 : 0 for (@vals);
if ($in){
# do my stuff
}
but I would really like to be able to write it in english form. I'm
searching for a way to do this because both I would like to be able to
use the english form syntax, but also because it would be an excelent
learning experience for me.
Thank,
David
this:
if ($val in @vals){
# do my stuff
}
Does anyone know of a way to cause a sub call to recieve the
scalar preseeding the sub call as well as the array following?
Essetialy I want to create a keyword called in which checks to see if
a list contains a certain value.
Yes I know I can use something like
my $in = $val eq $_ ? 1 : 0 for (@vals);
if ($in){
# do my stuff
}
but I would really like to be able to write it in english form. I'm
searching for a way to do this because both I would like to be able to
use the english form syntax, but also because it would be an excelent
learning experience for me.
Thank,
David