Praveen Nallari wrote:

>   
> Hi,
> 
> I am stuck at a very simple PERL script. The script and error message I have 
> attached below. Can someone please let me know where I have gone wrong?

Please post to just one group.  UNIX should be fine if on UNIX/Linux.

> The script is:
> 
> 
> #!/home/mds/bin/perl5.8.0
> 
> use strict;
> use Net::FTP;
> use File::Basename;
> use Cwd;
> my $wdir = cwd;
> my $host_ip = "qqq.qqq.qqq.qq";
> 
> # trying to connect to remopte host
> my $ftp = Net::FTP->new($host_ip,Debug => 0);
> 
> if( $ftp )
> {
>         print "Connected to host $host_ip\n";
> }
> else
> {
> #no connection is created
>         print  "Unable to connect to $host_ip\n";
>         exit 1;
> )
> ~

I assume the ) is really a } above.

> Error message is below:
> 
> syntax error at /home/mds/lib/perl5/PA-RISC1.1/5.003/IO/Handle.pm line 250, near 
> "use 5.006_001"
> BEGIN failed--compilation aborted at 
> /home/mds/lib/perl5/PA-RISC1.1/5.003/IO/Socket.pm line 11.
> BEGIN failed--compilation aborted at /home/mds/lib/perl5/Net/FTP.pm line 18.
> BEGIN failed--compilation aborted at simpleftp1.sh line 4.

This works fine on Windoze and connects (I turned debug on to
make sure - leave it on and see what it prints out) :

use strict;
use warnings;

use Net::FTP;
use File::Basename;
use Cwd;

my $wdir = cwd;
my $host_ip = 'your ip here';

my $ftp = Net::FTP->new($host_ip, Debug => 1) or
  die  "Unable to connect to $host_ip: $!\n";
print "Connected to host $host_ip\n";

__END__

Your errors at compile time mean either you have a syntax error or
a bad Perl build.  Run the above exactly as is (modify the IP) and
see what it yields.

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)


_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to