On 3/16/11 Wed  Mar 16, 2011  9:11 AM, "shawn wilson" <ag4ve...@gmail.com>
scribbled:

> On Mar 16, 2011 11:53 AM, <ind...@students.itb.ac.id> wrote:
>> 
>> 
>> if(@ARGV != 1){
>> 
> 
> I don't think you can look at an array like its a string like that.
> Maybe string( @ARGV ) != 1 might work. But what you probably want is:
> If( defined( $ARGV[ 0 ] ) )

Try it! 

The logical operator != gives scalar context to both left and right
operands. An array in scalar context returns the number of elements in the
array. Therefore, the expression (@ARGV != 1) will return true if the number
of elements in @ARGV is not exactly one.



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to