In perl there is the shift function that can act on the @_(arguments of a function in scope of which it was called) if no arguments supplied.
Can I write a custom function in perl with the same behavior(some kind of my_shift)?
I tried this:
use Data::Dumper;
sub get_caller_args (;$) {
  my $n = shift;
  $n = defined $n? $n:1;
  my $ret;
  package DB {
    my($t,$t1) = caller($n);
  };
  $ret = \@DB::args;
  return $ret;
}
sub test ($@) {
  my $self = shift;
  print "Self: $self.\n";
  print Dumper(get_caller_args()), "\n";
}
It kind of works, but
test(1,2,3)
outputs:
Self: 1.
$VAR1 = [
          1,
          2,
          3
        ];
So it doesn't see changes made by shift (though it can see changes made by pop).
But I want it to act like this:
sub test {
  my $self = shift;
  print my_function;
}
Here the my_function called without arguments must act on the @_, in this case on the rest of the arguments, without the first as it was shifted(actually I need only to read arguments, not to do changes).
