862_SoPW |-- weblogic_5 |-- A |-- B |-- org.apache.ant.1.3 |-- bin |-- weblogic_6 |-- A |-- B |-- C |-- org.apache.ant.1.4 |-- bin #### #! perl use strict; use warnings; use File::Find::Rule; for (5 .. 7) { my $ant_home = get_ant_home('weblogic_' . $_) // 'not found'; print "In weblogic_$_, ant home is: $ant_home\n"; } sub get_ant_home { my $test_dir = shift; my $module_dir = $test_dir . '/A'; my @subdirs = File::Find::Rule->directory->in($module_dir); for (@subdirs) { return $_ if /org\.apache\.ant\.\d+\.\d+$/; } } #### 1:45 >perl 862_SoPW.pl In weblogic_5, ant home is: weblogic_5/A/B/org.apache.ant.1.3 In weblogic_6, ant home is: weblogic_6/A/B/C/org.apache.ant.1.4 In weblogic_7, ant home is: not found 1:46 >