Importing a file with Perl

This Perl script lets you import a .bes file into the console. Pass your user name and password, along with the path of the .bes file and the name of the custom site where it is located. The usage is as follows:

ImportFile.pl <username> <password> <bes file path> <custom site name>

This is the code:

# TakeActionFromFixlet.pl

use strict;
use FindBin;
use lib $FindBin::Bin;
use BESAPI;
use Cwd 'abs_path';
use File::Basename;

if ( @ARGV != 4 && @ARGV != 5 ) {
      print fileparse(abs_path($0)) . " <server> <username> <password> 
      <bes file path> [<custom site name>]";
      exit( 0 );
}

my ( $server, $username, $password, $besFile, $customSite ) = @ARGV;
if ( !$customSite )
      { $customSite = ""; }

eval
{
      my $xmlImporter = BESAPI->new( "XMLImporter", $server );
      my $ids = $xmlImporter->ImportFile( $besFile, $customSite, $username, 
                                          $password );

      print "IDs: " . join( " ", @$ids ) . "\n";
};
if ( $@ )
{
      print "$@\n";
}