Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Use of uninitialized value for file name

by wfsp (Abbot)
on Apr 13, 2006 at 16:54 UTC ( #543151=note: print w/ replies, xml ) Need Help??


in reply to Use of uninitialized value for file name

When I'm stumped I often try reducing the script to the bare bones to get something working and gradually add things back in.

Something like:

#!/usr/bin/perl use warnings; use strict; my $dir = 'c:/Perl'; opendir DIR_A, $dir or die $!; while(my $job = readdir(DIR_A)){ print "$job\n"; } __DATA__ ---------- Capture Output ---------- > "C:\Perl\bin\perl.exe" _new.pl . .. bin Desktop.ini eg html lib myperl site Tidy > Terminated with exit code 0.
When you come up against the error you'll have a better chance of narrowing down the source of your grief.

Hope that helps.


Comment on Re: Use of uninitialized value for file name
Download Code
Re^2: Use of uninitialized value for file name
by Win (Novice) on Apr 13, 2006 at 17:59 UTC
    Thanks, I followed your advice and then realised that I was doing multiple whiles and forgetting to close file handles. Basic error I'm afraid.

      Had you been using lexical handles as it must have certainly been suggested to you (at least I *think* I did and I'm *confident* others did too), and properly scoped blocks, which should be natural in any case, then you wouldn't have needed explicit closes and you would have avoided this annoying error.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://543151]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-08-27 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (253 votes), past polls