Lawrence Statton wrote:

#
# open a connection to some host (I need passive mode here
# to get around my firewall, you may not, which case you
# can leave it out ) #


my $ftp = Net::FTP->new('your-host.com', Passive => 1) || die "Cannot connect to host: $@"; warn"Connection made....";

That statement *will* work but it does not do what you apparently think it does. The '||' operator has higher precedence than the '=' operator so it says: Assign the value of Net::FTP->new() to $ftp but if that is false then assign the value of die() to $ftp instead, but because die() exits the program you don't see the result of the wrong assignment. The correct way to do it is to either put parentheses around the assignment or use the lower precedent 'or' operator.



John -- use Perl; program fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to