Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: String parsing

by Abigail-II (Bishop)
on Jan 05, 2004 at 10:54 UTC ( #318808=note: print w/replies, xml ) Need Help??


in reply to String parsing

#!/usr/bin/perl use strict; use warnings; $" = ", "; while (<DATA>) { /^(\w+)(?:[(](\d+)[)])?:?/g or next; my ($status, $exit) = ($1, $2); my (@vars) = /\G[^(]*[(]([^)]*)[)]/g; print "Status: $status; "; print "Exit: $exit; " if defined $exit; print "Variables [@vars]" if @vars; print "\n"; } __DATA__ OFF SUCCESS: (abc) ERROR(1): disk number (27) crashed at (11:03) WARNING(1): system is rebooting Status: OFF; Status: SUCCESS; Variables [abc] Status: ERROR; Exit: 1; Variables [27, 11:03] Status: WARNING; Exit: 1;

Abigail

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2018-10-18 05:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (99 votes). Check out past polls.

    Notices?