in reply to Re^4: help with Archive::tar
in thread help with Archive::tar
with this short-circuit loop:my ($toc) = grep { $_->name =~ m{/toc$} } $tar->get_files;
That assumes that the first time you see "toc" as the file name, this is the actual "toc" file that you want. (It also checks for the case where a tarball lacks a "toc" file.)my $toc = undef; for my $file ( $tar->get_files ) { if ( $file->name =~ /toc$/ ) { $toc = $file; last; } } ( defined $toc ) or do { warn "no toc file in $wdir/$tarball\n"; n +ext };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: help with Archive::tar
by paulehr (Sexton) on Apr 04, 2006 at 20:32 UTC | |
by paulehr (Sexton) on Apr 04, 2006 at 22:05 UTC |