- or download this
sub detaint_1 {
$[0] =~ /^(.*)$/;
return $1;
}
- or download this
sub detaint_1_inp {
$[0] =~ /^(.*)$/;
$[0] = $1;
}
- or download this
sub detaint_n {
map { /^(.*)$/; $1 } @_;
...
sub detaint_n_inp {
foreach (@_) { /^(.*)$/; $_ = $1}
}
- or download this
my @a;
# ... set @a ...
my @b = map { detaint_1 } @a; # Copy
detaint_1_inp($_) foreach (@a); # In-place
- or download this
sub detaint {
my $subref = sub { $_[0] =~ /^(.*)$/; $1 };
...
$_ = &$subref($_) foreach (@_); # In-place
return;
}
- or download this
sub apply_filter {
my $subref = shift;
...
$v;
}, @_);
}