I am trying to handle files in a directory and everytime I try to pass the . and .. that come with this I get this error:
C:\Documents and Settings\UAS\Desktop\GRRUVI\gps\.
stat() on closed filehandle KID at GRRUVI-v1.611-gpsa.pl line 1950.
readline() on closed filehandle KID at GRRUVI-v1.611-gpsa.pl line 1951
+.
which tells me that it is trying to open the . or .. file. Any ideas on how I can get around this?
opendir(GPS,"$new_dir") or die "Cannot open direct
+ory";
my @GPS = readdir(GPS);
closedir(GPS);
foreach my $kid (@GPS){
#~ if ($kid ne "." or $kid ne ".."){
if (defined($kid)){
if ($kid !~ /.bak/ or $kid !~ /.txt/ o
+r $kid !~ /^\.{1,2}$/){
#~ if ($kid !~ /.bak/ or $kid !~ /.txt
+/){
open KID , '<', "$new_dir\\$kid";
my ($dev,$ino,$mode,$nlink,$uid,$g
+id,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat(KID);
my $data = <KID>;
close KID;
if (defined($data)){
my @data = split(" ", $data);
my $diff = time-$mtime;
if ($diff >= 3600){
unlink($kid);
}
elsif ($diff >= 20){
}
}
}
#~ }
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.