Hi,
I have the following code:
#!/usr/bin/perl
use diagnostics;
use strict;
use warnings;
my @Files = </flows/ft*>;
foreach my $File (@Files) {
print $File "\n";
}
I have the following files in /flows/
r...@stats1:/flows# ls -l
total 245M
-rwxrwxr-x 1 root root 146 Oct 13 15:31 ParseNetFlow*
-rw-r--r-- 1 root root 1.1M Dec 10 2008 fl-v05.2008-12-10.113743+0200
-rw-r--r-- 1 root root 49M Oct 7 17:04 ft-v05.2009-10-07.164930+0200
-rw-r--r-- 1 root root 49M Oct 7 17:19 ft-v05.2009-10-07.170421+0200
-rw-r--r-- 1 root root 13K Oct 13 2009 ft-v05.2009-10-13.204426+0200
-rw-r--r-- 1 root root 68K Oct 13 2009 ft-v05.2009-10-13.204702+0200
-rw-r--r-- 1 root root 64K Oct 13 2009 ft-v05.2009-10-13.210153+0200
-rw-r--r-- 1 root root 4.7M Dec 12 2008 tmp-v05.2008-12-12.022828+0200
-rw-r--r-- 1 root root 5.2M Dec 12 2008 tmp-v05.2008-12-12.032751+0200
-rw-r--r-- 1 root root 27M Dec 12 2008 tmp-v05.2008-12-12.092652+0200
-rw-r--r-- 1 root root 27M Dec 12 2008 tmp-v05.2008-12-12.102707+0200
-rw-r--r-- 1 root root 58M Dec 12 2008 tmp-v05.2008-12-12.142812+0200
-rw-r--r-- 1 root root 84 Mar 19 2009 tmp-v05.2009-03-19.224548+0200
-rw-r--r-- 1 root root 25M Oct 7 17:26 tmp-v05.2009-10-07.171910+0200
-rw-r--r-- 1 root root 65K Oct 13 15:31 tmp-v05.2009-10-13.211643+0200
I get:
r...@stats1:/flows# ./ParseNetFlow
Can't use string ("/flows/ft-v05.2009-10-07.164930+") as a symbol ref while
"strict refs" in use at ./ParseNetFlow line 9 (#1)
(F) Only hard references are allowed by "strict refs". Symbolic
references are disallowed. See perlref.
Uncaught exception from user code:
Can't use string ("/flows/ft-v05.2009-10-07.164930+") as a
symbol ref while "strict refs" in use at ./ParseNetFlow line 9.
at ./ParseNetFlow line 9
Naturally, perl doesn't like the + in the file names, but shouldn't it
be seen as a string by default? Is something a mess here, or did my
brain cease to work?
Thanks,
Chris.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/