statement-modifiers

Does Ruby best practice shun statement modifiers after, for example, a long code block that is passed to an iterator?

something.each do |x| #lots of stuff end if some_condition ...

What does a while after a print mean in Perl?

I am new to Perl. Know a little bit of C though. I came across this snippet in one of our classroom notes : $STUFF="c:/scripts/stuff.txt"; open STUFF or die "Cannot open $STUFF for read :$!"; print "Line $. is : $_" while (<STUFF>); Why is the while after the print statement? What does it do? ...

Proper usage of Ruby statement modifiers

I've just started working with Ruby, and discovered statement modifiers when RubyMine suggested I change this code: if !VALID_DIRECTIONS.include?(direction) raise ArgumentError, "Invalid direction" end to this: raise ArgumentError, "Invalid direction" if !VALID_DIRECTIONS.include?(direction) I like how it makes the code more suc...