なんか初歩的なんですけど。以下のファイルがある状態で。
$ ls [abcd] a b c d
次のコードを実行。
use warnings; use strict; my @file = qw(a b c d); print "### scalar context\n"; for my $file (@file) { print scalar glob $file; print "\n"; } print "### list context\n"; for my $file (@file) { print glob $file; print "\n"; }
$ perl hoge.pl ### scalar context a Use of uninitialized value in concatenation (.) or string at hoge.pl line 12. c Use of uninitialized value in concatenation (.) or string at hoge.pl line 12. ### list context a b c d
一部undefで返ってくる?
この辺あとで読む。