Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

net::ftp help

net::ftp help

net::ftp help

I'm calling a perl script on an NT machine that should FTP a file from a folder on the IFS to a library on the AS/400.
I'm new to perl so any help is appreciated.

use Net::FTP;

    $hostname = 'host';
    $username = 'user';
    $password = 'password';
    $file = 'path/file.txt';
    $remote = 'library.lib/file.member';
    $ftp = Net::FTP->new($hostname);      
    $ftp->login($username, $password);
    $ftp->put($file, $remote);

RE: net::ftp help

Your code looks ok as far as I can tell.  I copied it to my machine and ran it with one modification.  I do not have write permissions to an ftp server, so I used get instead of put.   Additionally, I used 'anonymous' as my user and an email looking string for a password, first.last@some.server.com.  Worked fine.  I have changed my server info below to keep ner'-do-wells away.

use Net::FTP;

$hostname = 'ftp.some.server.com';
$username = 'anonymous';
$password = 'first.last@someserver.com';

$file = '/local/path/to/file.extension';

$ftp = Net::FTP->new($hostname);      
$ftp->login($username, $password);

Can you tell us anything about error messages or other stuff that might help us diagnose your problem????  

 keep the rudder amid ship and beware the odd typo

RE: net::ftp help

You're right, the code was ok... It was part of a larger file and something above wasn't allowing it to even start (so I wasn't getting any error messages).

I got that to work, but now I've ran into another problem. I need to check the value of a text box to see if the first character is a number and then I'll set a variable if it is...

Here is the part of the script this deals with:

if (
    ($textbox eq ????)
) { $noerror = 1; }
else { $noerror = 0; }

I have no idea what to put where the question marks are...


RE: net::ftp help

You will need to use pattern matching rather than  'eq'.  Pattern matching will allow you to check for classes of characters.  

if ($textbox =~ /^\d/)    {    $noerror = 1;    }

The =~ is the pattern match operator.
The / and / are the pattern delimiters.  Look for what's in between.
The ^ says start at the front end of $textbox when checking for a match.
The \d says any digit.
So, if ($textbox matches /start with a digit/) { $noerror = 1; }

' Hope this is what you were looking for.

 keep the rudder amid ship and beware the odd typo

RE: net::ftp help

That's exactly what I was looking for.

Thanks a bunch!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close