From df5b31e34eef759b85447971526c6443ab017fa1 Mon Sep 17 00:00:00 2001 From: knu Date: Thu, 19 Dec 2002 20:30:05 +0000 Subject: The use of $_ and ~/RE/ is discouraged. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/dir.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sample') diff --git a/sample/dir.rb b/sample/dir.rb index 2465c4d68..b62738394 100644 --- a/sample/dir.rb +++ b/sample/dir.rb @@ -2,8 +2,10 @@ # list all files but .*/*~/*.o dirp = Dir.open(".") for f in dirp - $_ = f - unless (~/^\./ || ~/~$/ || ~/\.o/) + case f + when /^\./, /~$/, /\.o/ + # do not print + else print f, "\n" end end -- cgit