I
it_says_BALLS_on_your forehead
Hello All,
Under what circumstances (and in what manner) would it be advantageous
to use method A over method B?
*NOTE: these are just very simple examples, my real question is would
you ever want to use opendir and readdir? can one accomplish tasks with
these that would not be possible with glob?
A)
opendir(TMPDIR, $tmp) or die "can't open $tmp: $!\n";
while ( my $file = readdir(TMPDIR) ) {
print "$file exists.\n";
}
B)
print "$_ exists\n" for glob($tmp);
Under what circumstances (and in what manner) would it be advantageous
to use method A over method B?
*NOTE: these are just very simple examples, my real question is would
you ever want to use opendir and readdir? can one accomplish tasks with
these that would not be possible with glob?
A)
opendir(TMPDIR, $tmp) or die "can't open $tmp: $!\n";
while ( my $file = readdir(TMPDIR) ) {
print "$file exists.\n";
}
B)
print "$_ exists\n" for glob($tmp);