develooper Front page | perl.perl6.users | Postings from September 2018

words[] question

Thread Next
Todd Chester
September 26, 2018 04:11
words[] question
Message ID:
Hi All,
is no help

Not to ask too obvious a question, but why does words use a []
instead of a () ?

$ ls -al Win10_1803_English_x64.dd
-rwxrwxrwx. 1 todd root 7927234560 May  9 21:14 Win10_1803_English_x64.dd

$ ls -al Win10_1803_English_x64.dd | p6 'my $x = slurp(); say $x.words[4]'

This is not the forth word:

$ ls -al Win10_1803_English_x64.dd | p6 'my $x = slurp(); say $x.words(4)'
(-rwxrwxrwx. 1 todd root)

Many thanks,

Another way to read a pipe.  The "n" must come before the "e"

$ ls -al Win10_1803_English_x64.dd | perl6 -ne 'say $_.words[4]'

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About