From: Philip Mateescu Date: 2004-07-03T01:13:17+09:00 Subject: Help with one-liner Hello, I'm having problems with an one-liner (ruby 1.6.8 (2003-02-25) [i386-cygwin]). My one liner sample: $ ping localhost | ruby -e '$<.readlines.each { |line| line.chomp!(); puts(line + "---\n"); }' I would expect it to put --- at the end of each line. Instead it replaces the first 3 chars of each line with "---" --- ---ging nha-a30p-009.nha.corp [127.0.0.1] with 32 bytes of data: --- ---ly from 127.0.0.1: bytes=32 time<1ms TTL=128 ---ly from 127.0.0.1: bytes=32 time<1ms TTL=128 ---ly from 127.0.0.1: bytes=32 time<1ms TTL=128 ---ly from 127.0.0.1: bytes=32 time<1ms TTL=128 --- ---g statistics for 127.0.0.1: --- Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), ---roximate round trip times in milli-seconds: --- Minimum = 0ms, Maximum = 0ms, Average = 0ms What am I doing wrong? And why? :) Thanks. Best regards. philip ---- break; /* don't do magic till later */ -- Larry Wall in stab.c from the perl source code ---