Refurnishing my Perl skills.

Just for practice. It's slow, need to add a timeout => 1

Code:
#!/usr/perl/bin
use warnings;
use IO::Socket;
use Getopt::Std;

my %options;

getopts('h:s:f:all:', \%options);

my $host = $options{h};
my $startport = $options{s};
my $finishport = $options{f};

if(!$options{h} || !$options{s} || !$options{d})
{
print "HostName: $options{h}\n";
print "Start Port: $options{s}\n";
print "Finish Port: $options{f}\n";

print "Starting...\n";



for ($port=$startport;$port<=$finishport;$port++) {
$sock = IO::Socket::INET->new(PeerAddr => $host, 
PeerPort => $port,
Proto => 'tcp');
if ($sock) {
print "::$port open port::\n"; 
} else {
print "-$port closed port-\n";
}
}
}
Edit: Woah I found my old one. Lucky me. :]

Code:
#!/usr/bin/perl

print "\n\n***Port Scanner***\n\n";


use IO::Socket;

my ($line, $port, $sock, @servers);

my $VERSION='1.2'; #The version number :)
($server = $ARGV[0]) || &usage; #Server to start

$begin = ($ARGV[1] || 0); #Begining port - or -all flag

$maxport = ($ARGV[2] || 0); #Ending port

if($ARGV[1] == "-all") { #Custom function to scan 'all' ports (1 - 3000)
$begin = (1);
$maxport = (3000);
print "Starting a scan of all ports (1 - 3000) on $ARGV[0] ...\n\n";

for ($port=$begin;$port<=$maxport;$port++) {
$sock = IO::Socket::INET->new(PeerAddr => $server, #Connect to target
PeerPort => $port,
Proto => 'tcp');
if ($sock) {
print "::$port [OPEN]::\n"; #Display if the port is open or closed
} else {
print "-$port [Closed]-\n";
}
} # End for
sub usage {  #How to use information below
print "\nUsage: Scan.pl hostname [start at port number] [end at port number]\n";
print "Other, custom flags: \n-vnc**\n-all\n(more to come)";
exit(0);
}