On 4/27/05, Ing. Branislav Gerzo <[EMAIL PROTECTED]> wrote: > Jay Savage [JS], on Wednesday, April 27, 2005 at 10:26 (-0400) > thoughtfully wrote the following: > > JS> If all you want is the last column, this is a really long way to go about > it. > JS> while (<V4>) { > JS> print (split)[7]; > JS> print "\n"; > JS> } > > (split)[-1] is better, not ? >
That depends on where you think you're data is going to get corrupted. If you think something might throw a space in the middle of one of the the other colums (e.g. "s g F01010"), (split)[-1] will work better. On the other hand, if you think your input may contain something like this at you: 6 2005/02/28 22:47 180 100% -il-o-b----- sg F01005 !error: you need to grab (split)[7]. For general use, I thinkit's basically a matter of personal preference. In this case, it probably doesn't really matter: He's done 2>&1 on the piped open, so there's no way to predict when the buffers will be flushed or where stderr will be inserted into stdin. some of the input is going to be munged either way. Jay -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>