use Archive::Unrar qw(list_files_in_archive process_file); use IO::CaptureOutput qw(capture); my @files; { local ($stdout, $stderr); capture sub {list_files_in_archive( file=>"C:/perl2exe/For perl 5.10.1/test.rar" ,undef)}, \$stdout, \$stderr; @files=map {/Archive contents : (.*\.txt$)/ } split ("\n",$stdout); } foreach (@files) { print "file ",++$i," : ",$_,"\n"; }