I thought I got it to work but it seems it still errors out.
This is the code I'm using to connect where the sub routine catchError is user defined:
my $scpe = Net::SCP::Expect->new(host=>"$import_host",user=>"$import_user",password=>"$import_pwd",auto_yes=>1) or $scp_err=1;
$scpe->host("$import_host") or $scp_err=1;
$scpe->user("$import_user") or $scp_err =1;
$scpe->login("$import_user","$import_pwd") or $scp_err=1;
$scpe->error_handler(catchError());
$scpe->scp("$import_file","$local_file") or $scp_err=1;
This is the error I'm currently getting
Can't use string ("1") as a subroutine ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.0/Net/SCP/Expect.pm line 226.
The catchError subroutine is defined above it call.
Any help would be much appreciated. Thanks