> 
> R. Joseph Newton wrote:
> > Mark VanMiddlesworth wrote:
> >> What's wrong with the syntax, especially line 12?
> 
> >>                  if ($arg = "-n") {$e = 0}   # Line 12

Sorry if I'm misunderstanding what your're tryin gto do but to me it seems :

$arg = $ARGV[0]; # or whatever/however you assign the value of '-n' to $arg

if($arg eq "-n") { ...
Or
if($arg =~ m/^\-n$/) { ...

If you are simplt checking to see if $arg has a value of '-n' then the = is not right, 
just on equal sign is assigning a value and then you're getting different results than 
if you were doing a comparison operator like 'eq', 'ne' or '==', '!='.
Etc.

So if you're wanting to check $arg's value then you need to use a comparison operator 
not an assignment one.

> >
> > You are asking, in the line above, whether your assignment 
> of "-n" to 
> > the scalar $arg succeeded.  Answer: true, always.
> 
> Not quite. Mark is asking if the value contained in $arg is 
> 'true' after assigning "-n" to it. As everyone knows, N is 
> always true, while Y is often false. This is preferable:
> 
>     if ($arg = -x) {$f = 0}   # Line 13
> 
> as it is only true in the rarest of cases, and won't
> spuriously set your $f variable to zero without a
> second thought.
> 
> ;-)
> 
> Rob
> 
> 
> 
> 
> -- 
> 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]

Reply via email to