develooper Front page | perl.perl6.users | Postings from March 2019

I need help with "lines"

Thread Next
From:
Todd Chester via perl6-users
Date:
March 15, 2019 05:05
Subject:
I need help with "lines"
Message ID:
40544bba-e74d-bf5c-0998-fc8188304b31@zoho.com
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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About