I am looking to iterate through these data structures (basically a directory structure) which I pass a given path.
The goal is to list the root/base path and then list out all the sub paths if they exist and for every sub path that exists, list the file from that sub path.
I know this probably requires looping through HoH or AoH. Can someone show me the perl techniques for doing this? Thanks.
Base level: /work/eng/feeds
$VAR1 = {
'recursive' => 'no',
'version' => '0.20.202.1.1101050227',
'time' => '2011-10-26T00:20:18+0000',
'filter' => '.*',
'path' => '/work/eng/feeds',
'directory' => [
{
'owner' => 'tst_act',
'group' => 'eng',
'permission' => 'drwxrwxr-x',
'path' => '/work/eng/feeds',
'accesstime' => '1970-01-01T00:00:00+0000',
'modified' => '2011-08-27T03:13:53+0000'
},
{
'owner' => 'tst_act',
'group' => 'eng',
'permission' => 'drwxr-xr-x',
'path' => '/work/eng/feeds/customer_care',
'accesstime' => '1970-01-01T00:00:00+0000',
'modified' => '2011-10-25T23:54:17+0000'
}
],
'exclude' => ''
};
Next level: /work/eng/feeds/customer_care
$VAR1 = {
'recursive' => 'no',
'version' => '0.20.202.1.1101050227',
'time' => '2011-10-26T00:21:06+0000',
'filter' => '.*',
'path' => '/work/eng/feeds/customer_care',
'directory' => [
{
'owner' => 'tst_act',
'group' => 'eng',
'permission' => 'drwxr-xr-x',
'path' => '/work/eng/feeds/customer_care',
'accesstime' => '1970-01-01T00:00:00+0000',
'modified' => '2011-10-25T23:54:17+0000'
},
{
'owner' => 'tst_act',
'group' => 'eng',
'permission' => 'drwx------',
'path' => '/work/eng/feeds/customer_care/abc',
'accesstime' => '1970-01-01T00:00:00+0000',
'modified' => '2011-10-25T17:12:56+0000'
},
{
'owner' => 'tst_act',
'group' => 'eng',
'permission' => 'drwx------',
'path' => '/work/eng/feeds/customer_care/def',
'accesstime' => '1970-01-01T00:00:00+0000',
'modified' => '2011-10-25T21:05:50+0000'
},
{
'owner' => 'tst_act',
'group' => 'eng',
'permission' => 'drwx------',
'path' => '/work/eng/feeds/customer_care/test',
'accesstime' => '1970-01-01T00:00:00+0000',
'modified' => '2011-10-25T21:28:14+0000'
}
],
'exclude' => ''
};
One more level: /work/eng/feeds/customer_care/test (here a file exists)
$VAR1 = {
'recursive' => 'no',
'version' => '0.20.202.1.1101050227',
'time' => '2011-10-26T00:30:02+0000',
'filter' => '.*',
'file' => {
'owner' => 'tst_act',
'replication' => '3',
'blocksize' => '134217728',
'permission' => '-rw-------',
'path' => '/work/eng/feeds/customer_care/test/q_data_20111023.dat',
'modified' => '2011-10-26T00:29:46+0000',
'size' => '379085',
'group' => 'eng',
'accesstime' => '2011-10-26T00:29:46+0000'
},
'path' => '/work/eng/feeds/customer_care/test',
'directory' => {
'owner' => 'tst_act',
'group' => 'eng',
'permission' => 'drwx------',
'path' => '/work/eng/feeds/customer_care/test',
'accesstime' => '1970-01-01T00:00:00+0000',
'modified' => '2011-10-26T00:29:46+0000'
},
'exclude' => ''
};
each,keysandvalues, or to readperlreftut?