in reply to Re^8: manipulating cpio archive
in thread manipulating cpio archive
with something like thisOLD BUGGED CODE: sub remove { my ($cpio, @filenames) = @_; $cpio->{list} or die "can't remove from nothing\n"; my %filenames = map { $_ => 1 } @filenames; @{$cpio->{list}} = grep { !$filenames{$_} } @{$cpio->{list}}; }
How should this be done?WRONG NEW CODE sub remove { my ($cpio, @filenames) = @_; $cpio->{list} or die "can't remove from nothing\n"; foreach $item (@{$cpio->{list}}) { foreach $file (@filesnames) { if ($item->{name} eq $file){ delete @{$cpio2->{list}->{$item}}; } } } return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: manipulating cpio archive
by Corion (Patriarch) on Jan 18, 2011 at 08:30 UTC | |
by momo33 (Beadle) on Jan 18, 2011 at 09:26 UTC | |
by Corion (Patriarch) on Jan 27, 2011 at 11:37 UTC |