because you are using ==
that's for numerical compares
numerical, SOS and 'all' are the same
use 'eq'
hth
Jos Boumans
----- Original Message -----
From: "Bob Bondi" <[EMAIL PROTECTED]>
To: "Beginners-perl" <[EMAIL PROTECTED]>
Sent: Friday, July 27, 2001 12:54 AM
Subject: Why does this conditional fail? Perl bug?
> Probably not a Perl bug, but this is so confusing I' probably enter it as
a
> bug....
> Given the script below and the fact that you run it like:
> > perl foo.pl -p 10.0.0.1 -s 8080 -t SOS
>
> what would you expect the output to be?
>
>
> use strict;
> use Getopt::Std;
>
> my %opts = ();
> getopt('pst', \%opts);
> my $proxy = $opts{p};
> my $serviceport = $opts{s};
> my $this_string = $opts{t};
>
> if ($this_string == "all") {
> print "WHY AM I HERE\n";
> }
> else {
> print "YES! I AM HERE\n";
> }
>
> I'd expect: YES! I AM HERE, yet what I get is: WHY AM I HERE.
>
> Please, any help on this one will be happily accepted.
>
>
----------------------------------------------------------------------------
----
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]