Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Think about Loose Coupling
 
PerlMonks  

Re: Command Parsing

by aaron_baugher (Deacon)
on Apr 25, 2012 at 17:46 UTC ( #967125=note: print w/ replies, xml ) Need Help??


in reply to Command Parsing

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.


Comment on Re: Command Parsing
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967125]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2014-04-20 18:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (486 votes), past polls