Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hmm... let's see... If I were going to golf this down... I think the first thing I'd want to do would be to get rid of a bunch of unnecessary temporary variables and just let the results flow, using the return value from one thing as the argument for the next (i.e., functional paradigm). In this case, this would probably also mean turning the foreach loop into a map. Perhaps something like this (untested, because I'm not on MS Windows here):
Inside the map, you've already got a map, but you're using it like another foreach loop, which is weird. But anyway, I'd do basically the same thing inside of there. For example, we can do without the @list variable.
That's all purely mechanical, changes that can be made more or less automatically, without thinking very hard about what the code's doing. If I wanted to go much further, I'd have to slow down a bit probably and actually know what's going on, maybe get a Microsoft Windows system and look at the output of tasklist so I can see what's being parsed, etc. In reply to Re: Using Map and RegEx for data extraction
by jonadab
|
|