On Thu, Dec 16, 2010 at 9:47 PM, C.DeRykus <dery...@gmail.com> 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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to