develooper Front page | perl.beginners | Postings from October 2009

Re: Am I doing something really stupid?

Thread Previous
From:
jm
Date:
October 13, 2009 06:41
Subject:
Re: Am I doing something really stupid?
Message ID:
772427f40910130641u34d017fcmb7371d079ea181e0@mail.gmail.com
not sure, but try

print "$File\n";

including the var in the quotes may take care of the problem


On Tue, Oct 13, 2009 at 8:34 AM, <cknipe@savage.za.org> wrote:

>
> 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/
> root@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:
> root@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-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>


-- 
since this is a gmail account, please verify the mailing list is included in
the reply to addresses

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About