I am trying to get the following to work:

dir = Dir.new( d ) if( File.directory?( d=$*.shift ) )
puts d
puts dir

d always outputs correctly, but dir always outputs nil. I tried

puts d if( File.directory?( d=$*.shift ) )

and d is outputted correctly. Why doesn't my first statement work?

Thanks,

Zach