Ryan is an engineer in the Sacramento Area with a focus in Python, Ruby, and Rust. Bash/Python Exercism mentor. Coding, physics, calculus, music, woodworking. Looking for work!
Thanks! I think I've got most everything updated. That input-output redirect is especially good to know.
I left the F.first and F.last because I think they're a bit easier to read, and it's possibly a bit more idiomatic Ruby to use methods when they're available (like using item.zero? instead of item == 0). If you wanted the second item, $F[1] would be fair though.
Anyways, thanks for helping me make my post better, I really appreciate it!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Good one, liked the way concepts are introduced :)
Some note points:
1)
$_
is default for regex match (also note the missing dot)2) Don't redirect output to same file as input, you'll be left with empty file
See bash pit fall , stackoverflow, unix.stackexchange etc
3) As shown in last but one example,
$_.gsub!
can be shortened togsub
4) Can also use indexing to get first/last element of array, i.e
$F[0]
and$F[-1]
respectivelyThanks! I think I've got most everything updated. That input-output redirect is especially good to know.
I left the
F.first
andF.last
because I think they're a bit easier to read, and it's possibly a bit more idiomatic Ruby to use methods when they're available (like usingitem.zero?
instead ofitem == 0
). If you wanted the second item,$F[1]
would be fair though.Anyways, thanks for helping me make my post better, I really appreciate it!