We don't bite newbies here... much | |
PerlMonks |
using less structuresby ovedpo15 (Pilgrim) |
on Aug 28, 2019 at 13:32 UTC ( [id://11105165]=perlquestion: print w/replies, xml ) | Need Help?? |
ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:
I wrote the following code:
Before that, It only worked for $opt_href->{"data"}. Now I'm trying to add $opt_href->{"file"}. In case of $opt_href->{"data"} I just split a string of paths in format: ~main~,~main~,...,~main~ and for each main I find its subs. For $opt_href->{"file"} I get a file where each line is in format of ~main~,~sub~ and in that case I don't need to find them. In the first case I use the array @roots_paths and in the second case I have to use two structures %paths and @roots_paths. I'm looking for a way to simplify it, I don't like the additional push push(@roots_paths,$main); I have to do. Is there a way to achieve it? Somehow using the same structure? Hope my question makes sense.
Back to
Seekers of Perl Wisdom
|
|