Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Regular expression quantifiers and the /gsmx modifiers

by davis (Vicar)
on Jun 16, 2012 at 22:17 UTC ( #976604=note: print w/replies, xml ) Need Help??

in reply to Re: Regular expression quantifiers and the /gsmx modifiers
in thread Regular expression quantifiers and the /gsmx modifiers

Damn. I completely missed that.

#!/usr/bin/perl use warnings; use strict; use Data::Dumper; my $vg_details = ' --- Physical volumes --- PV Name /dev/dsk/c14t3d1 PV Name /dev/dsk/c15t3d1 Alternate Link PV Status available Total PE 15997 Free PE 0 Autoswitch On Proactive Polling On '; while($vg_details =~ m/^\s*PV\s+Name\s*(?<pv_name>\S+)\s*$ \n (^\s*PV\s+Name\s+(?<alt_link>\S+)\s+Alternate\s+Link\s*$ \n){0,20} + # skip them ^\s*PV\s+Status\s+(?<pv_status>\S+)\s*$ \n ^\s*Total\s+PE\s+(?<total_pe>\S+)\s*$ \n ^\s*Free\s+PE\s+(?<free_pe>\d+)\s*$ \n ^\s*Autoswitch\s+(?<autoswitch>\S+)\s*$ \n ^\s*Proactive\s+Polling\s+(?<proactive_polling>\S+)\s*$ \n/gsmx) { my $pv_name = $+{pv_name}; print "matched $pv_name"; }

Seems to DWIM. I genuinely cannot believe I've been gawping at that for so long. My thanks.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://976604]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2016-12-07 12:09 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (125 votes). Check out past polls.