#!/usr/bin/perl use warnings; use strict; use Text::CSV_XS; use XML::Twig; my $twig = 'XML::Twig'->new(...); my $csv = 'Text::CSV_XS'->new(...); my $listfile = shift; open my $list, '<', $listfile or die $!; while (my $xmlfile = <$list>) { chomp $xmlfile; $twig->parsefile($xmlfile); ... }