Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Perl Permissions

by virtualsue (Vicar)
on Dec 03, 2006 at 14:41 UTC ( #587514=note: print w/replies, xml ) Need Help??


in reply to Perl Permissions

It's a good idea to take a look at what your variables contain when you find that your code is not working as you expect. What's in $currentlog? What is $hour? It's quite likely that the first 2 entries in @logfiles are '.' (the current directory) and '..' (the directory above the current directory). You probably don't want to open either one of those. Have a look at the filenames you are reading from "/perl/ass/" in the order that they appear in the array @logfiles:
use warnings; use strict; opendir(LOGS, "/perl/ass/") or die "Couldn't open /perl/ass/, $!"; my @logfiles = readdir(LOGS); print "File: $_\n" for @logfiles;
Enabling warnings is useful, for example it would have pointed out your typo when you set $currentlog (use $logfiles[$hour] instead).

Update: Oh, Win32. Your initial code threw me off because you used '/' in your file and directory paths. I don't do enough Win32 work to help - sorry.

Replies are listed 'Best First'.
Re^2: Perl Permissions
by blundell (Novice) on Dec 03, 2006 at 14:48 UTC
    Yeah i've been useing the step through function to see whats in them, i start the $hour variable at 2 to avoid the leading ',' & '..' , $currentlog is the first subfolder in /ass/ "1-month-go"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://587514]
help
Chatterbox?
[Lady_Aleena]: Renaming things like get_THAC0 to just THAC0 was easy. These are harder.
[james28909]: consolidate the three subs into one
[Lady_Aleena]: Um, what?
[james28909]: check is is data or hash or array and do tasks then return needed data
[Lady_Aleena]: james28909, you might want to look at the other two on my scratchpad.
[james28909]: after you send to a sub, you can check if it is array or ref ect with ref
[james28909]: check if it is a hash or an array ect with ref in one sub.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-05-24 04:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?