#!/usr/bin/env perl # This very simple little script allows a text file with a URL per line to be # specified as input. This file will be read and every line added as a new # element in the files.xml file. use strict; use File::Slurp; die "Unable to open 'files.xml' for reading...\n" unless -f 'files.xml'; die "No input file specified...\n" unless $ARGV[0]; my @lines = read_file('files.xml'); my @new_lines; for my $i (0 .. $#lines) { push(@new_lines, $lines[$i]) unless $lines[$i] =~ /^<\/doapFiles>/; } @lines = read_file($ARGV[0]); for my $i (0 .. $#lines) { push(@new_lines, " \n", $lines[$i], " \n"); } push(@new_lines, "\n"); write_file('files.xml', @new_lines);