| ew73 | Wow, I'm just sort of mindlessly watching and penut-gallery-ing, and ks is pissing me off. I feel for Randal and integral. |
| ks | haha |
| action | integral decides to be very mean and not tell ks about the tutorials that randal got the bot to send them |
| integral | decides to be very mean and not tell ks about the tutorials that randal got the bot to send them |
| Randal | heh |
| ks | thanks Randal |
| Randal | at this point, I have a far thicker skin than most but I still hit my boiling point |
| integral | eval: my $ds = { abc => { xyz => 123 } }; sub walk { if (ref $_[0] eq "HASH") { return map walk($_), values %{$_[0]} } else { return $_[0] } } walk($ds) |
| buubot | integral: 1 |
| integral | bugger |
| ks | beth well i'm trying to re-use existing functions/components instead of re-writing it for the 100th time |
| ew73 | pwnecd |
| Randal | [walk($ds)] |
| integral | ah! |
| Randal | otherwise you have map in a scalar context |
| integral | ks: Well, that's good, but don't blindly pick an incorrect component such as Data::Dumper and then stubbornly stick to it eval: my $ds = { abc => { xyz => 123 } }; sub walk { if (ref $_[0] eq "HASH") { return map walk($_), values %{$_[0]} } else { return $_[0] } } [walk($ds)] |
| buubot | integral: [123] |
| Randal | see - I *am* useful for something. :) |
| ew73 | Horray! \o/ |
| Randal | although I would have put the arrayref into the map branch of the if |
| integral | ks: As an exercise, rewrite &walk to use a looping construct rather than recursion. |
| Randal | so the result would have been a nested scalar |
| overkordbaever | How do you solve input? My solution doesn't seem to be so nice, a lot of regexp and one if-test for each regex |
| integral | Well, it depends what you want the function to do, Randal :) |
| Randal | "solve" input? true -it does |
| ew73 | I almost always use loops. Recursion gives me a headache. |
| integral | overkordbaever: Shoot all the users, that way there is no input. |
| PerlJam | overkordbaever: "solve input"? |
| Randal | if all you want is flat leaf nodes, you did it |
| integral | ew73: That's the cheap vodka |
| Randal | if you want a tree rep of the leaf nodes, [] in the map branch. :) |
| overkordbaever | For example, i get the input simpledb --get -t cars for example |
| Randal | you want an @ARGV parser |
| PerlJam | overkordbaever: you mean "validate"? |
| integral | Getopt::Long has always served me well. |
| Randal | see Getopt::(something) |