il 18 Mar 2004 02:50:45 -0800, alw / it-service.sdu.dk (Allan Wermuth) ha scritto:: >I have tried to rewrite an old short Perl script, that reads a Unix >password file, and prints loginname and realname if the userid number >is greater than 100. The Perl script is here: > > >I have been reading "Programming Ruby" written by The Pragmatic >Programmers, and >I have no trouble opening the password file, and I can also print the >file content to the screen. I am having a problem writing the loop the >"Ruby way". untested: open('/etc/passwd') do |fd| fd.each do |line| data=line.split(':') next if data[0] =~ /^#/ printf "%12s %30s\n", data[0], data[4] if data[2].to_i >100 end end