On 2012-03-10 17:13, Dr.Ruud <
rvtol+...@xs4all.nl> wrote:
> On 2012-03-10 17:51,
xho...@gmail.com wrote:
>> "Dr.Ruud"<
rvtol+...@xs4all.nl> wrote:
>
>>> perl -wle'print for glob "{1,2,3}{4,5,6}{7,8}"'
>>
>> I haven't tried this on a newer perl, but at least on older ones this
^^^^^^^^^^
>> method will get slow and beat the crap out of your hard drive as the list
>> gets longs. It checks whether each string exists as a filename, but the
>> results of that check are ignored.
>
> Why do you think it would go to disk?
Because older ones *do* go to disk?
% strace perl -wle'print for glob "{1,2,3}{4,5,6}{7,8}"'
[...]
lstat64("147", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("148", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("157", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("158", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("167", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("168", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("247", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("248", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("257", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("258", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("267", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("268", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("347", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("348", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("357", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("358", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("367", 0xbf910610) = -1 ENOENT (No such file or directory)
lstat64("368", 0xbf910610) = -1 ENOENT (No such file or directory)
write(1, "147\n", 4147
) = 4
write(1, "148\n", 4148
) = 4
write(1, "157\n", 4157
) = 4
[...]
% perl -v
This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi
(with 56 registered patches, see perl -V for more detail)
Copyright 1987-2009, Larry Wall
><quote src=`perldoc -f glob`>
> If non-empty braces are the only wildcard characters used in
> the "glob", no filenames are matched, but potentially many
> strings are returned.
></quote>
This sentence isn't there in 5.10.1. If newer perls don't try to stat
the files any more (note that "no filenames are matched" doesn't
necessarily imply this), then the change was made after 5.10.1
hp
--
_ | Peter J. Holzer | Deprecating human carelessness and
|_|_) | Sysadmin WSR | ignorance has no successful track record.
| | |
h...@hjp.at |
__/ |
http://www.hjp.at/ | -- Bill Code on
as...@irtf.org