On Thu, Dec 16, 2010 at 9:47 PM, C.DeRykus <[email protected]> wrote:
> There weren't any matches with files and no wildcards
> in the glob pattern so the pattern itself is returned *. If
> there had been a wildcard in the pattern, then nothing
> would have been returned.
>
Thanks. But still being confused about the case below.
[an...@localhost tmp]$ ls foo*
foo.1 foo.2 foo.3
[an...@localhost tmp]$ cat t2.pl
#!/usr/bin/perl -l
use strict;
for (1..10) {
if (my $x=glob "foo.$_") {
print $x;
print "yes";
} else {
print $x;
print "no";
}
print "-------------";
}
[an...@localhost tmp]$ perl t2.pl
foo.1
yes
-------------
no
-------------
foo.3
yes
-------------
no
-------------
foo.5
yes
-------------
no
-------------
foo.7
yes
-------------
no
-------------
foo.9
yes
-------------
no
-------------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/