The Fun With Regexes way, though probably not the clearest or most efficient:
#!/usr/bin/env perl use Modern::Perl; my $text = do { local($/) = undef; <DATA> }; $text =~ s|\s*[{}]\s*||g; $text =~ s|\s*;\s*| |g; $text =~ s|\b(\w)|uc($1)|ge; $text =~ s| = |:|g; $text =~ tr|a-z||d; say $text; __DATA__ { availableAgentCount = 101; availableProcessorCount = 186; offlineAgentCount = 0; offlineProcessorCount = 0; onlineAgentCount = 101; onlineProcessorCount = 186; totalAgentCount = 101; unavailableAgentCount = 0; unavailableProcessorCount = 0; workingAgentCount = 0; workingAgentPercentage = 0; workingMegaHertz = 0; workingProcessorCount = 0; }
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
In reply to Re: Command Parsing
by aaron_baugher
in thread Command Parsing
by jcstech
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |