In Perl, the command line arguments are stored in the @ARGV array. $#ARGV can get the number of arguments.
#!/usr/bin/perl
if ($#ARGV == 0) {
die("Not enough arguments!");
}
$input = shift @ARGV;
open FILE, ">$input.txt" or die("Can't open input file: $!");