#!/usr/bin/perl use strict; use warnings; use IO::Socket; my $remote_server = "ftp.server.net"; my $remote_port = 21; my $sock = IO::Socket::INET->new("$remote_server:$remote_port") || die $!; my $data = "HELP"; my $string_to_compare = "^220 "; print $sock "$data\r\n"; my @output; $| = 1; while (<$sock>) { push(@output, $_); print $sock "QUIT\n" if /$string_to_compare/gi; } close($sock); my $output = join('', @output); sub true { print "Ain't dat da true! :o)\n"; # open(tmpl, "email.txt") || print $!; } sub false { print "Close, but no banana.\n"; } if ($output =~ /$string_to_compare/gi) { &true; } else { &false; }