Ok so in this kind of situation I tend to break it down into smaller stages so :
ps ax | grep [f]irefox 4277 tty2 Sl+ 1:08 /usr/lib/firefox/firefox 4780 tty2 Sl+ 2:44 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab 5088 tty2 Sl+ 0:27 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 82 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab 5094 tty2 Sl+ 1:15 /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 82 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab 5106 tty2 Sl+ 1:02 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 82 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab 5188 tty2 Sl+ 0:16 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 176 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab 5734 tty2 Sl+ 0:07 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 6102 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab Then : ps ax | grep [f]irefox | perl -ne '@x = .words; @x.say' [4277 tty2 Sl+ 1:10 /usr/lib/firefox/firefox] [4780 tty2 Sl+ 2:50 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab] [5088 tty2 Sl+ 0:27 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 82 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab] [5094 tty2 Sl+ 1:18 /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 82 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab] [5106 tty2 Sl+ 1:02 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 82 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab] [5188 tty2 Sl+ 0:16 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 176 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab] [5734 tty2 Sl+ 0:07 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 6102 -prefMapSize 177920 -schedulerPrefs 0001,2 -parentBuildID 20190215001155 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 4277 true tab] All looking good so far. what is it you're wanting from this data? On Fri, 15 Mar 2019 at 06:14, Todd Chester via perl6-users < perl6-us...@perl.org> wrote: > >> On Fri, 15 Mar 2019, 05:34 Todd Chester via perl6-users, > >> <perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote: > >> > >> > >> > >> 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 > >> > > > > On 3/14/19 10:53 PM, Simon Proctor wrote: > > 6am here and I'm not at a computer but I think your problem is trying to > > use both -n which runs your code on each line of STDIN and lines. > > > > Try one or the other see what happens. > > > > Once I'm ambulant and at a computer I'll poke at it myself. > > > Thank you anyway. > > > $ ps ax | grep [f]irefox | perl6 -n 'my @x = $_.words[0].lines.reverse; > print @x[0] ~ "\n";' > Could not open my @x = $_.words[0].lines.reverse; print @x[0] ~ "\n";. > Failed to stat file: no such file or directory > > $ ps ax | grep [f]irefox | perl6 -e 'my @x = $_.words[0].lines.reverse; > print @x[0] ~ "\n";' > No such method 'words' for invocant of type 'Any' > in block <unit> at -e line 1 > > > > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/