Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2018-07-20 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (427 votes). Check out past polls.

    Notices?