http://www.perlmonks.org?node_id=879507

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, According to my logic I need to accomplish in this script(Logic: My perl script should check for a certain column(column name STATUS) in a table(table name INFO). If the status column is equal to 'I OR D' it has to look at the data in the" ID ,number column", remember that ID and number and then go to the location "c:\Documents and Settings\user\Files and delete the directories that are named by this ID.).

I was able to connect to oracle and select the required columns and print them, but need help from here. How to remember the data in the "ID " column and go to the location " c:\Documents and Settings\user\Files" and delete these directories.

Current Script: #!/usr/perl/5.8.8/bin/perl -w use strict; use DBI; my $db = DBI->connect( "dbi:Oracle:*****", "*****", "******" ) || die( $DBI::errstr . "\n" ); $db->{AutoCommit} = 0; $db->{RaiseError} = 1; $db->{ora_check_sql} = 0; $db->{RowCacheSize} = 16; my $SEL = "SELECT number,id,status FROM info where status in ('I,D')" +; my $sth = $db->prepare($SEL); $sth->execute(); while ( my @row = $sth->fetchrow_array() ) { foreach (@row) { $_ = "\t" if !defined($_); print "$_\t"; } print "\n"; } END { $db->disconnect if defined($db); } current output: number Id status HDF0008 89456R I HDF0009 34567R D Files: c:\Documents and Settings\user\Files HDF0009 -> 34567R -> folder1 , folder2 .... HDF0008 -> 89456R -> folder1 , folder2.... DIR -> Subdirectory -> older1 , folder2....