ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:
Before that, It only worked for $opt_href->{"data"}. Now I'm trying to add $opt_href->{"file"}.if(defined($opt_href->{"data"})) { @roots_paths = (split /,/, $opt_href->{"data"}); } else { my $file_path = $opt_href->{"file"}; open(my $fh, '<', "$file_path") or return 0; while (my $row = <$fh>) { chomp($row); if ($row =~ /(.*),(.*)/) { my ($main,$sub) = ($1,$2); my $fub_path = $main."/".$sub; next unless(isValidDir($fub_path)); push(@{$paths{$main}},$fub_path); push(@roots_paths,$main); } } close ($fh); } foreach my $main (sort(uniq(@roots_paths))) { if(defined($opt_href->{"data"})) { find( sub { get_valid_dir( \@list_of_dirs, $_ ) }, $root_path) +; } else { @list_of_dirs = @{$paths{$main}}; } # More same code here... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using less structures
by Marshall (Canon) on Aug 28, 2019 at 18:17 UTC | |
|
Re: using less structures
by talexb (Chancellor) on Aug 28, 2019 at 13:48 UTC |