... use File::Basename; my $file = fileparse($path); $scp->scp($path, "$remote->{user}\@$remote->{host}:$destination/$file");