Thread delete $array[$i]
(8 answers)
Opened by rosti at 2018-12-10 19:05
Nun, wir haben ja tie():
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 use Data::Dumper; $Data::Dumper::Sortkeys = 1; use strict; use warnings; use Tie::Array; use base qw(Tie::StdArray); tie my @arr, 'main'; @arr = qw(foo bar baz); delete $arr[0]; print Dumper \@arr; sub DELETE{ my $self = shift; my $idx = shift; splice @$self, $idx, 1; } Und dann macht auch delete das was es soll ;) . |