Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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); }