Re: I need regex help

2018-05-10 Thread ToddAndMargo

On 05/10/2018 09:26 PM, ToddAndMargo wrote:

On 05/10/2018 09:13 PM, ToddAndMargo wrote:
On Thu, May 10, 2018 at 11:56 PM, ToddAndMargo 
> wrote:


    Hi All,

    I am trying to convert this over from Perl5:

    P5:
    $dir_entry  =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;

    P6:
    $dir_entry  ~~ m/.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*{$Extension}/;


    $ perl6 -c GetUpdates.pl6
    ===SORRY!===
    Unsupported use of {N,M} as general quantifier; in Perl 6 please 
use

    ** N..M (or ** N..*)
    at /home/linuxutil/GetUpdates.pl6:425
    --> $dir_entry  ~~
    m/.*?(\d{1,4}⏏\D\d{1,4}\D\d{1,4}).*{$Extension}/;


    What am I doing wrong?


    Many thanks,
    -T



On 05/10/2018 09:11 PM, Brandon Allbery wrote:
Pretty much what it's telling you. Instead of the numbers in braces, 
it's the ** operator with a range after it: \d ** 1..4
(Remember that spaces do nothing in a P6 regex, so you can use them 
for readability or to separate the range from what follows, etc.)




The light bulb is not firing.  How do I change {1.4}
over to p6?



Light bulb finally went off:

$dir_entry ~~ m/.*?(\d**1..4 \D \d**1..4 \D \d**1..4).*{$Extension}/;

Took a bit





Gee Wiz.  I am only up to line 567 of my big p5 to p6 change over.
It is going to be a long time getting to line 5833.

:'(




--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: I need regex help

2018-05-10 Thread ToddAndMargo

On 05/10/2018 09:13 PM, ToddAndMargo wrote:
On Thu, May 10, 2018 at 11:56 PM, ToddAndMargo > wrote:


    Hi All,

    I am trying to convert this over from Perl5:

    P5:
    $dir_entry  =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;

    P6:
    $dir_entry  ~~ m/.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*{$Extension}/;


    $ perl6 -c GetUpdates.pl6
    ===SORRY!===
    Unsupported use of {N,M} as general quantifier; in Perl 6 please use
    ** N..M (or ** N..*)
    at /home/linuxutil/GetUpdates.pl6:425
    --> $dir_entry  ~~
    m/.*?(\d{1,4}⏏\D\d{1,4}\D\d{1,4}).*{$Extension}/;


    What am I doing wrong?


    Many thanks,
    -T



On 05/10/2018 09:11 PM, Brandon Allbery wrote:
Pretty much what it's telling you. Instead of the numbers in braces, 
it's the ** operator with a range after it: \d ** 1..4
(Remember that spaces do nothing in a P6 regex, so you can use them 
for readability or to separate the range from what follows, etc.)




The light bulb is not firing.  How do I change {1.4}
over to p6?



Light bulb finally went off:

$dir_entry ~~ m/.*?(\d**1..4 \D \d**1..4 \D \d**1..4).*{$Extension}/;

Took a bit



--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: I need regex help

2018-05-10 Thread ToddAndMargo
On Thu, May 10, 2018 at 11:56 PM, ToddAndMargo > wrote:


Hi All,

I am trying to convert this over from Perl5:

P5:
$dir_entry  =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;

P6:
$dir_entry  ~~ m/.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*{$Extension}/;


$ perl6 -c GetUpdates.pl6
===SORRY!===
Unsupported use of {N,M} as general quantifier; in Perl 6 please use
** N..M (or ** N..*)
at /home/linuxutil/GetUpdates.pl6:425
--> $dir_entry  ~~
m/.*?(\d{1,4}⏏\D\d{1,4}\D\d{1,4}).*{$Extension}/;


What am I doing wrong?


Many thanks,
-T



On 05/10/2018 09:11 PM, Brandon Allbery wrote:
Pretty much what it's telling you. Instead of the numbers in braces, 
it's the ** operator with a range after it: \d ** 1..4
(Remember that spaces do nothing in a P6 regex, so you can use them for 
readability or to separate the range from what follows, etc.)




The light bulb is not firing.  How do I change {1.4}
over to p6?


Re: I need regex help

2018-05-10 Thread Brandon Allbery
Pretty much what it's telling you. Instead of the numbers in braces, it's
the ** operator with a range after it: \d ** 1..4
(Remember that spaces do nothing in a P6 regex, so you can use them for
readability or to separate the range from what follows, etc.)

On Thu, May 10, 2018 at 11:56 PM, ToddAndMargo 
wrote:

> Hi All,
>
> I am trying to convert this over from Perl5:
>
> P5:
> $dir_entry  =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;
>
> P6:
> $dir_entry  ~~ m/.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*{$Extension}/;
>
>
> $ perl6 -c GetUpdates.pl6
> ===SORRY!===
> Unsupported use of {N,M} as general quantifier; in Perl 6 please use **
> N..M (or ** N..*)
> at /home/linuxutil/GetUpdates.pl6:425
> --> $dir_entry  ~~ m/.*?(\d{1,4}⏏\D\d{1,4}\D\d{1,4
> }).*{$Extension}/;
>
>
> What am I doing wrong?
>
>
> Many thanks,
> -T
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


I need regex help

2018-05-10 Thread ToddAndMargo

Hi All,

I am trying to convert this over from Perl5:

P5:
$dir_entry  =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;

P6:
$dir_entry  ~~ m/.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*{$Extension}/;


$ perl6 -c GetUpdates.pl6
===SORRY!===
Unsupported use of {N,M} as general quantifier; in Perl 6 please use ** 
N..M (or ** N..*)

at /home/linuxutil/GetUpdates.pl6:425
--> $dir_entry  ~~ 
m/.*?(\d{1,4}⏏\D\d{1,4}\D\d{1,4}).*{$Extension}/;



What am I doing wrong?


Many thanks,
-T


Re: need -c help

2018-05-10 Thread ToddAndMargo

On 05/10/2018 07:37 PM, ToddAndMargo wrote:

Hi All,

I am converting a YUGE program over from Perl 5 to
Perl 6 (Perl 5's subs drive me INSANE).

$ perl6 -c GetUpdates.pl6
===SORRY!=== Error while compiling /home/linuxutil/CurlUtils.pm6
Variable '$TimeOut' is not declared. Did you mean '$Timeout'?
at /home/linuxutil/CurlUtils.pm6:24
-->    if ⏏$TimeOut { $TimeOutStr = "--connect-time


This picked up a bogus error in a pm6.  ($TimeOut is declared in
the sub's declaration and the pm6 is working well with other
programs.)

Is there a way to tell -c to not go looking at the subs and just
stay on the pl6 in question?


Many thanks,
-T


Never mind.  I don't want to talk about it.


need -c help

2018-05-10 Thread ToddAndMargo

Hi All,

I am converting a YUGE program over from Perl 5 to
Perl 6 (Perl 5's subs drive me INSANE).

$ perl6 -c GetUpdates.pl6
===SORRY!=== Error while compiling /home/linuxutil/CurlUtils.pm6
Variable '$TimeOut' is not declared. Did you mean '$Timeout'?
at /home/linuxutil/CurlUtils.pm6:24
-->if ⏏$TimeOut { $TimeOutStr = "--connect-time


This picked up a bogus error in a pm6.  ($TimeOut is declared in
the sub's declaration and the pm6 is working well with other
programs.)

Is there a way to tell -c to not go looking at the subs and just
stay on the pl6 in question?


Many thanks,
-T


Re: any better explanation of look ahead assertions

2018-05-10 Thread ToddAndMargo

On 05/10/2018 07:12 PM, Brad Gilbert wrote:

On Thu, May 10, 2018 at 9:09 PM, ToddAndMargo  wrote:

On 05/10/2018 07:06 PM, Brad Gilbert wrote:


You could read how they work in PCRE



What is PCRE?


Perl Compatible Regular Expressions,

Basically someone reimplemented the regular expression engine found in Perl,
and that is the basis of what every other language uses.



$ rpm -qa pcre
pcre-8.42-1.fc28.i686
pcre-8.42-1.fc28.x86_64

Well now!


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: any better explanation of look ahead assertions

2018-05-10 Thread Brad Gilbert
On Thu, May 10, 2018 at 9:09 PM, ToddAndMargo  wrote:
> On 05/10/2018 07:06 PM, Brad Gilbert wrote:
>>
>> You could read how they work in PCRE
>
>
> What is PCRE?

Perl Compatible Regular Expressions,

Basically someone reimplemented the regular expression engine found in Perl,
and that is the basis of what every other language uses.


Re: any better explanation of look ahead assertions

2018-05-10 Thread ToddAndMargo

On 05/10/2018 07:06 PM, Brad Gilbert wrote:

You could read how they work in PCRE


What is PCRE?


Re: any better explanation of look ahead assertions

2018-05-10 Thread Brad Gilbert
On Thu, May 10, 2018 at 8:13 PM, ToddAndMargo  wrote:
> Hi All,
>
> Looking at:
> https://docs.perl6.org/language/regexes#Lookahead_Assertions
> https://docs.perl6.org/language/regexes#Lookbehind_assertions
>
> I can't tell heads from tails.  Does anyone know of a better
> reference/explanation for beginners?
>

You could read how they work in PCRE, as there are a lot more sources for it.

It is difficult to wrap your head around, as it matches some text without moving
the current position.

Also I find that I don't use it that often, so you might just want to
put off learning it
until you are more experienced using regexes. Who knows, maybe by then it will
be easier to understand.

I might look into making it easier to understand.
(I'm all talk though, so I wouldn't hold your breath)


any better explanation of look ahead assertions

2018-05-10 Thread ToddAndMargo

Hi All,

Looking at:
https://docs.perl6.org/language/regexes#Lookahead_Assertions
https://docs.perl6.org/language/regexes#Lookbehind_assertions

I can't tell heads from tails.  Does anyone know of a better
reference/explanation for beginners?


Many thanks,
-T


Re: I need `dir` help

2018-05-10 Thread ToddAndMargo

On 05/10/2018 05:42 PM, Brad Gilbert wrote:

On Thu, May 10, 2018 at 7:02 PM, ToddAndMargo  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!


Re: I need `dir` help

2018-05-10 Thread Brad Gilbert
On Thu, May 10, 2018 at 7:02 PM, ToddAndMargo  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'


Re: I need indir help

2018-05-10 Thread ToddAndMargo
On Thu, May 10, 2018 at 8:04 PM, ToddAndMargo > wrote:


Hi All,

I am over on
https://docs.perl6.org/routine/indir


I can make heads of tails out of what is going on.

I want to check is a file exists.


$ perl6 -e 'say indir("./EchoTest");'
===SORRY!=== Error while compiling -e
Calling indir(Str) will never work with any of these multi signatures:
 ($path, , :$test!)
 ($path, , :$d = Bool::True, :$r, :$w, :$x)
at -e:1


Many thanks,
-T


On 05/10/2018 05:18 PM, Brandon Allbery wrote:
Testing whether a file exists is smartmatching an IO::Path (or a Str 
that gets coerced to one) against :e.


"indir" is not "is this file in this directory?", it's "run this code in 
this directory instead of where I am now". So it's complaining that you 
didn't tell it what code to run there.




Hi Brandon,

Ah poop!  That explains it.  I wrote down your explanation in
my directory notes.

Thank you!

-T


Re: I need indir help

2018-05-10 Thread Brandon Allbery
Testing whether a file exists is smartmatching an IO::Path (or a Str that
gets coerced to one) against :e.

"indir" is not "is this file in this directory?", it's "run this code in
this directory instead of where I am now". So it's complaining that you
didn't tell it what code to run there.

On Thu, May 10, 2018 at 8:04 PM, ToddAndMargo  wrote:

> Hi All,
>
> I am over on
> https://docs.perl6.org/routine/indir
>
> I can make heads of tails out of what is going on.
>
> I want to check is a file exists.
>
>
> $ perl6 -e 'say indir("./EchoTest");'
> ===SORRY!=== Error while compiling -e
> Calling indir(Str) will never work with any of these multi signatures:
> ($path, , :$test!)
> ($path, , :$d = Bool::True, :$r, :$w, :$x)
> at -e:1
>
>
> Many thanks,
> -T
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


I need indir help

2018-05-10 Thread ToddAndMargo

Hi All,

I am over on
https://docs.perl6.org/routine/indir

I can make heads of tails out of what is going on.

I want to check is a file exists.


$ perl6 -e 'say indir("./EchoTest");'
===SORRY!=== Error while compiling -e
Calling indir(Str) will never work with any of these multi signatures:
($path, , :$test!)
($path, , :$d = Bool::True, :$r, :$w, :$x)
at -e:1


Many thanks,
-T


Re: I need `dir` help

2018-05-10 Thread ToddAndMargo

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.



Perl6 has all the cool tools,.

:-)

Thank you for all the help!

-T


Re: I need `dir` help

2018-05-10 Thread Brandon Allbery
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.

On Thu, May 10, 2018 at 7:52 PM, ToddAndMargo  wrote:

> 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 >> > wrote:
>>>
>>> https://docs.perl6.org/routine/dir >> e/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
> ~~
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: I need `dir` help

2018-05-10 Thread ToddAndMargo

On 05/10/2018 04:52 PM, Brandon Allbery wrote:
The last line of my message, quoted above, is there for a reason. An 
IO::Path is not a Str.


I understand now.  Thank you!


Re: I need `dir` help

2018-05-10 Thread ToddAndMargo

On 05/10/2018 04:52 PM, ToddAndMargo wrote:

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 > wrote:


    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






This works:
$ perl6 -e 'for dir() -> $x { my $y="$x"; say $y };'
eraseme.pl6
crashme.pl6
DisableCaplock
...


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: I need `dir` help

2018-05-10 Thread Brandon Allbery
On Thu, May 10, 2018 at 7:49 PM, ToddAndMargo  wrote:

> On 05/10/2018 04:43 PM, Brandon Allbery wrote:
>
>> On Thu, May 10, 2018 at 7:34 PM, ToddAndMargo > > wrote:
>> 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
>

The last line of my message, quoted above, is there for a reason. An
IO::Path is not a Str.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: I need `dir` help

2018-05-10 Thread ToddAndMargo

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 > wrote:


    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
~~


Re: I need `dir` help

2018-05-10 Thread ToddAndMargo

On 05/10/2018 04:43 PM, Brandon Allbery wrote:
On Thu, May 10, 2018 at 7:34 PM, ToddAndMargo > wrote:


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


Re: I need `dir` help

2018-05-10 Thread Brandon Allbery
On Thu, May 10, 2018 at 7:34 PM, ToddAndMargo  wrote:

> 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".

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: I need `dir` help

2018-05-10 Thread jerry gay
i'm afraid you didn't read the docs very closely...

Returns the contents of a directory as a lazy list of IO::Path objects


stringifying an IO::Path object gives you a large string.

the examples in the docs take up more room than the description of the
routine. here's the first:

Examples:
> # To iterate over the contents of the current directory:
> for dir() -> $file {
> say $file;
> }


i suspect iterating over the contents of the object returned by the dir
routine, as documented in the link you provided, will produce the expected
results.

~particle

On Thu, May 10, 2018 at 4:34 PM, ToddAndMargo  wrote:

> Hi All,
>
> 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.
>
>
> Many thanks,
> -T
>
>
> --
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~
>


I need `dir` help

2018-05-10 Thread ToddAndMargo

Hi All,

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.


Many thanks,
-T


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~