Front page | perl.perl6.users |
Postings from November 2019
need windows loop help
Thread Next
From:
ToddAndMargo via perl6-users
Date:
November 23, 2019 05:52
Subject:
need windows loop help
Message ID:
fdace957-f522-5175-7ce3-e897b77ceccb@zoho.com
Hi All,
C:\NtUtil>C:\rakudo\bin\perl6.bat -v
This is Rakudo Star version 2019.03.1 built on MoarVM version 2019.03
implementing Perl 6.d.
Windows 7 SP1, x64
I am trying to write a simple loop in Windows and I
am doing something wrong.
@Result definitely have something in it.
This what the data looks like outside of perl:
C:\NtUtil>wmic.exe volume get deviceid,label,name
DeviceID Label Name
\\?\Volume{c9b182e9-96a0-11e2-9a72-806e6f6e6963}\ System Reserved
\\?\Volume{
c9b182e9-96a0-11e2-9a72-806e6f6e6963}\
\\?\Volume{e20f10e6-6b04-4748-b7b8-2704997af1f1}\ KVM-W7-Backup M:\
\\?\Volume{c9b182ea-96a0-11e2-9a72-806e6f6e6963}\ DRIVE_C C:\
\\?\Volume{5efeb388-02e8-11e8-9297-806e6f6e6963}\ D:\
\\?\Volume{4084e22f-03c2-11e9-bb20-806e6f6e6963}\ virtio-win-0.1.1 E:\
This is my code.
<UUID.pl6>
my @Result;
@Result = qx ( wmic.exe volume get deviceid,label,name ).lines;
say @Result[0];
say @Result[2];
say @Result[4];
say @Result[6];
say @Result[8];
say "for @Result loop";
for @Result.lines.kv -> $I, $Line {
say $I;
# if $Line.words[2] = "BACKUP" { say $Line.words[1]; }
# say $Line.words[1];
# say $Line.words[2];
# say $Line.words[3];
# say "";
}
</UUID/pl6>
This is the result:
C:\NtUtil>C:\rakudo\bin\perl6.bat UUID.pl6
DeviceID Label Name
\\?\Volume{c9b182e9-96a0-11e2-9a72-806e6f6e6963}\ System Reserved
\\?\Volume{
c9b182e9-96a0-11e2-9a72-806e6f6e6963}\
\\?\Volume{e20f10e6-6b04-4748-b7b8-2704997af1f1}\ KVM-W7-Backup M:\
\\?\Volume{c9b182ea-96a0-11e2-9a72-806e6f6e6963}\ DRIVE_C C:\
\\?\Volume{5efeb388-02e8-11e8-9297-806e6f6e6963}\ D:\
for @Result loop
0
Why is the loop stopping at @Result[0] ?
Confused,
-T
Thread Next
-
need windows loop help
by ToddAndMargo via perl6-users