justin423 has asked for the wisdom of the Perl Monks concerning the following question:
my $SQL= "INSERT INTO DIRECTORY_LIST(FILENAME) VALUES ('$filename')"; my $sth= $dbh->prepare($SQL) or die "Prepare".$dbh->errstr; opendir my $dh, $dir or die "Could not open '$dir' for reading: $!\n"; $sth-> execute() or die "".$dbh->errstr; while (my $row = readdir $dh) { if ($filename eq '.' or $filename eq '..'){ next; my ($filename)=($row->[0]); } print "$filename\n"; } print "\n"; closedir $dh; $dbh->disconnect;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: READDIR and DBI
by marto (Cardinal) on Feb 26, 2024 at 17:26 UTC | |
by Anonymous Monk on Feb 26, 2024 at 17:51 UTC | |
by pryrt (Abbot) on Feb 26, 2024 at 20:53 UTC | |
by LanX (Saint) on Feb 26, 2024 at 18:27 UTC | |
by justin423 (Scribe) on Feb 26, 2024 at 18:05 UTC | |
Re: READDIR and DBI
by erix (Prior) on Feb 26, 2024 at 20:07 UTC | |
Re: READDIR and DBI
by cavac (Prior) on Feb 27, 2024 at 12:41 UTC | |
Re: READDIR and DBI
by Anonymous Monk on Feb 26, 2024 at 21:11 UTC |