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

words[] question

Thread Next
From:
Todd Chester
Date:
September 26, 2018 04:11
Subject:
words[] question
Message ID:
8ed7e0b5-c7bf-bf39-bedb-fbad43a83ed4@zoho.com
Hi All,

https://docs.perl6.org/routine/words
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]'
7927234560


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,
-T


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]'
2730070016

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