On 05/10/2018 05:42 PM, Brad Gilbert wrote:
On Thu, May 10, 2018 at 7:02 PM, ToddAndMargo <toddandma...@zoho.com> wrote:
On 05/10/2018 04:56 PM, Brandon Allbery wrote:

I think you'll need to provide a better explanation of what you're trying
to accomplish. I can think of lots of ways to do useful things with the
output of dir(), but have no idea which one(s) you need.


I wanted to loop through entries as an exercise.  Although this
is not really necessary with `indir` as you can ask directly
if something is in a directory.


That's not what `indir` does

What it does is change the current working directory inside of a block

     put $*CWD; # /home/brad
     indir "/tmp", {
         put "in directory $*CWD"; # /tmp
         .put for dir()
     }
     put $*CWD; # /home/brad


Also this

     $ perl6 -e 'for dir() -> $x { my $y="$x"; say $y };'

can be simplified to any of:

     $ perl6 -e 'for dir() -> $x { say ~$x }'
     $ perl6 -e 'for dir() -> $x { put $x }'
     $ perl6 -e '.put for dir'


Thank you!

Reply via email to