On 3/14/19 10:05 PM, Todd Chester via perl6-users wrote:
Hi All,

What am I doing wrong here?

ps ax | grep [f]irefox | perl6 -ne 'my @x = $_.words[0].lines.reverse; print @x[0] ~ "\n";'
7380
7581
7698
13023
13767
13908


Two problems:

1) "lines" is putting everything into @x[0]

2) "reverse" is ignoring me as there is no @x[1]. etc.

The result I want is 13908

Many thanks,
-T

And why do I have a broken pipe here?

$ ps ax | grep [f]irefox | perl6 -ne 'say $_.lines.sort.reverse.words[0];'
7380
7581
7698
13023
13767
22369

$ ps ax | grep [f]irefox | perl6 -ne 'say $_.lines.sort.reverse.words[0];' | sort -r

Failed to write bytes to filehandle: Broken pipe
  in block <unit> at -e line 1

Reply via email to