Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Help with Multiple line RegEx

by blackadder (Hermit)
on Oct 10, 2005 at 11:32 UTC ( [id://498772]=note: print w/replies, xml ) Need Help??


in reply to Re: Help with Multiple line RegEx
in thread Help with Multiple line RegEx

Yes, This is good

But I think it can all be done in one liner!

Like Browser_UK suggestion.
$Rec->{$1} = $2 if ($_=~ /-+\s+show (switchname)\s+-+\n(\w+)\n\*+/mg);
Blackadder

Replies are listed 'Best First'.
Re^3: Help with Multiple line RegEx
by gargle (Chaplain) on Oct 10, 2005 at 11:55 UTC

    TIMTOWTDI

    It's easy to write code that a computer can read, it's not so easy to write code that a human can understand.

    It's a choice. The 'select' can easily be written as a single regexp. But think about later? What's easier to adapt? The single statement or the multiple statement?

    I, for one, like code that shows its intend, even when coding in perl ;)

    --
    if ( 1 ) { $postman->ring() for (1..2); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-19 05:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found