On 05/10/2018 04:49 PM, ToddAndMargo wrote:
On 05/10/2018 04:43 PM, Brandon Allbery wrote:
On Thu, May 10, 2018 at 7:34 PM, ToddAndMargo <toddandma...@zoho.com
<mailto:toddandma...@zoho.com>> wrote:
https://docs.perl6.org/routine/dir
<https://docs.perl6.org/routine/dir>
perl6 -e 'my $x=dir; say "$x";'
Does indeed read the directory, but give me one YUGE string.
I need each entry to have some kind of a separator.
I'd say you did that to yourself, by wrapping it in quotes thereby
forcing it to turn into a simple single string. $x itself is a Seq of
IO::Path objects.
It will be easier to track this if you capture into an array (@x
instead of $x) and iterate over the contents. Or iterate directly:
pyanfar Z$ 6 'for dir() -> $x { say "$x" }'
debian-8.2.0-amd64-lxde-CD-1.iso
lb.txt
screenshotF-20161029T192446.png
haskell-report-1.4.ps.gz
hkcart.jpg
(...)
I'm quoting $x there for the same reason, to turn the IO::Path into a
Str. Although arguably the correct way to do that is $x.Str instead of
"$x".
I get a bunch of quotes and .IO's
:'(
$ perl6 -e 'for dir() -> $x { say $x };'
"eraseme.pl6".IO
"crashme.pl6".IO
"DisableCaplock".IO
"OpenSmartSuite".IO
using "$x" removes the quotes and .IO, but I need to test each
line without the quotes and .IO's
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~