Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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.


davis


Comment on Re^2: Regular expression quantifiers and the /gsmx modifiers
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-12-18 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (41 votes), past polls