In order to create a simple PERL script that can scan for open ports on a target machine, we can use the IO::Socket::INET module.
This module helps us to connect to specific ports and check whether they're open.
Here's a bash script that scans for a range of TCP ports on a target machine:
use strict;
use warnings;
use IO::Socket::INET;
my $target = '192.168.1.1';
my $start_port = 1;
my $end_port = 1000;
for my $port ($start_port .. $end_port) {
    my $socket = IO::Socket::INET->new(
        PeerAddr => $target,
        PeerPort => $port,
        Proto    => 'tcp',
        Timeout  => 2
    );
    if ($socket) {
        print "Port $port is open\n";
        close($socket);
    }
}
This bash script will check each port within the specified range and if any connection is made within the timeout period, the port is reported as open.