in reply to Re: What does my @x= (undef)x7; do?
in thread What does my @x= (undef)x7; do?
Yes, it should work; but, strangely, it doesn’t:
#! perl use strict; use warnings; use Data::Dump; use Win32API::File qw(getLogicalDrives GetVolumeInformation); my @drives = getLogicalDrives(); for my $d (@drives) { # my @x = (undef) x 7; my @x; $#x = 6; # dd \@x; GetVolumeInformation($d, @x); print "$d $x[0] ($x[5])\n"; }
Output:
1:16 >perl 1442_SoPW.pl Modification of a read-only value attempted at C:/Perl/Strawberry/stra +wberry-perl-5.22.0.1-64bit-PDL/perl/lib/Win32API/File.pm line 269. 1:16 >
But with the line dd \@x; uncommented, it does work:
1:16 >perl 1442_SoPW.pl [undef, undef, undef, undef, undef, undef, undef] C:\ (NTFS) [undef, undef, undef, undef, undef, undef, undef] D:\ () [undef, undef, undef, undef, undef, undef, undef] E:\ () 1:16 >
What’s going on?
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: What does my @x= (undef)x7; do?
by BrowserUk (Patriarch) on Nov 09, 2015 at 15:32 UTC | |
by betterworld (Curate) on Nov 09, 2015 at 17:53 UTC | |
by AnomalousMonk (Archbishop) on Nov 09, 2015 at 18:34 UTC | |
by BrowserUk (Patriarch) on Nov 10, 2015 at 04:55 UTC | |
by betterworld (Curate) on Nov 10, 2015 at 09:04 UTC | |
by BrowserUk (Patriarch) on Nov 10, 2015 at 11:34 UTC | |
by AnomalousMonk (Archbishop) on Nov 10, 2015 at 17:46 UTC | |
by BrowserUk (Patriarch) on Nov 10, 2015 at 17:58 UTC | |
|