#!/usr/bin/perl -w
use strict;
use Net::FTP;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
my $home="mysite.com";
my $username="username";
my $password="password";
my $directory="data/edit";
my $filename="data.txt";
my $filename1="path/to/file/data.txt";
my $ftp = Net::FTP->new("$home") or die "Can't connect: 1 $@\n";
$ftp->login($username, $password) or die "Couldn't login - 1\n";
$ftp->cwd($directory) or die "Couldn't change directory - 1\n";
$ftp->get($filename, $filename1) or die "Couldn't get $filename - 1\n";
my @lines = $ftp->ls("/data/edit");
$ftp->quit;
print "Content-type: text/html\n\n";
print "
@lines
";